Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

CNContactStore.ChangeHistory

Queries history changes in the contacts database.

Component Version macOS Windows Linux Server iOS SDK
Contacts 15.1 ✅ Yes ❌ No ❌ No ❌ No ✅ Yes
MBS( "CNContactStore.ChangeHistory" { ; startingToken; shouldUnifyResults; includeGroupChanges; excludedTransactionAuthor } )   More

Parameters

Parameter Description Example Flags
startingToken Request changes made after a certain point.
If non-empty, only changes made after this point in history will be returned.

If empty, a DropEverything event will be returned, followed by an add event for every contact and group currently in the contacts database.
Optional
shouldUnifyResults Returns contact changes as unified contacts.
If 1, returns unified contact history. Otherwise returns individual contact history. Default is 1.
A unified contact is the aggregation of properties from a set of linked individual contacts. If an individual contact is not linked then the unified contact is simply that individual contact.
1 Optional
includeGroupChanges Pass 1 to include group changes.
Defaults to 0 for none.
1 Optional
excludedTransactionAuthor Exclude changes made by certain authors.
If set, transactions made by the specified authors will be excluded from the results. Use this, in conjunction with CNContactStore.SetTransactionAuthor, to suppress processing of changes you already know about.
Optional

Result

Returns JSON or error.

Description

Queries history changes in the contacts database.
You may use this to learn what changed between runs of your solution in FileMaker Pro. For example you could implement a sync script to run this and see what changed since the last run. You need to store the token you get in a field, so you can pass it to the next call.

The returned JSON object includes an entry for currentHistoryToken with the new token for your next call. The events entry is an array with the events. Events have an event entry with one of the following texts: DropEverything, AddContact, UpdateContact, DeleteContact, AddGroup, UpdateGroup, DeleteGroup, AddMemberToGroup, RemoveMemberFromGroup, AddSubgroupToGroup or RemoveSubgroupFromGroup.
The event object also includes information like contact, container, group, subgroup and member. This way you get the identifiers for what contact changed, what container it belongs to. For groups the id for the group, the subgroup and member related to the event.

Examples

First run:

MBS( "CNContactStore.ChangeHistory")

Example result:
{ "events" : [ { "event" : "DropEverything" }, { "event" : "AddContact", "contact" : "773E1A42-ABCD-4CCF-88DE-E9C64BEE6D33:ABPerson", "container" : null }, { "event" : "AddContact", "contact" : "3AE8473F-73E4-49D9-B37A-7C168613D45F:ABPerson", "container" : null }, ... { "event" : "AddGroup", "container" : null, "group" : "77808CF4-E11E-4D95-A975-E2A99F4BCC3E:ABGroup" }, ... ], "currentHistoryToken" : "62706C6973743030D...0000000001CB" }

Second run:

MBS( "CNContactStore.ChangeHistory"; "62706C6973743030D...0000000001CB")

Example result:
{ "events" : [ { "event" : "UpdateContact", "contact" : "064A341F-0E73-4494-A79E-ECC17EA3A865:ABPerson" } ], "currentHistoryToken" : "62706C6973743030D...0000000001CB" }

See also

Release notes

Blog Entries

This function checks for a license.

Created 5th March 2025, last changed 5th March 2025


CNContactStore.AuthorizationStatus - CNContactStore.Contacts