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


Sets the value of a contact.

Component Version macOS Windows Linux Server iOS SDK
Contacts 8.4 ✅ Yes ❌ No ❌ No ❌ No ✅ Yes
MBS( "CNContact.SetValue"; ContactIdentifier; Selector { ; Value } )   More


Parameter Description Example Flags
ContactIdentifier The contact identifier. "46B1E34D-58F9-4B6B-A80D-0F71ABB87A0E"
Selector Which value to set. "givenName"
Value The value to set. "Test" Optional


Returns OK or error.


Sets the value of a contact.
Selector can be birthday, contactRelations, dates, departmentName, emailAddresses, familyName, givenName, imageData, imageDataAvailable, instantMessageAddresses, jobTitle, middleName, namePrefix, nameSuffix, nickname, nonGregorianBirthday, organizationName, phoneNumbers, phoneticFamilyName, phoneticGivenName, phoneticMiddleName, phoneticOrganizationName, postalAddresses, previousFamilyName, socialProfiles, thumbnailImageData, note, type or urlAddresses.
ImageData and thumbnailImageData are passed as containers.
PhoneNumbers, emailAddresses, postalAddresses, urlAddresses, contactRelations, socialProfiles, instantMessageAddresses, dates, birthday and nonGregorianBirthday are passed as JSON.

See also Apple's documentation:

For iOS 13 or later or macOS 16 or later, the note property can't be set or read unless the application has permissions for that and FileMaker Pro doesn't have these. AppleScript may work around this.


Set given name fo ra contact:

Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "givenName"; "Joe" ) ]

Clear email for contact:

// first set email list to empty JSON array:
MBS( "CNContact.SetValue"; "BD2307E5-92F6-4A8F-946D-C4804615C18B:ABPerson"; "emailAddresses"; "[]") &
// and save
MBS( "CNContactStore.UpdateContact"; "BD2307E5-92F6-4A8F-946D-C4804615C18B:ABPerson" )

Set email list with two emails:

// set email address list:
MBS( "CNContact.Value"; "BD2307E5-92F6-4A8F-946D-C4804615C18B:ABPerson"; "emailAddresses"; "[{ \"label\" : \"_$!<Home>!$_\", \"value\" : \"\" }, { \"label\" : \"My Label\", \"value\" : \"\" } ]") &
// and save
MBS( "CNContactStore.UpdateContact"; "BD2307E5-92F6-4A8F-946D-C4804615C18B:ABPerson" )

Set birthday:

Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "Birthday"; "{\"day\":\"27\",\"month\":\"12\",\"year\":\"1963\"}") ]

Set birthday with variables to build JSON:

Set Variable [ $birthday ; Value: JSONSetElement ( "{}" ; ["day" ; $day ; JSONNumber]; ["month" ; $month ; JSONNumber]; ["year" ; $year ; JSONNumber] ) ]
Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "Birthday"; $birthday) ]

Set contact to be organization:

Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "Type"; "Organization") ]

Set notes field for contact:

Set Variable [ $r ; Value: MBS( "CNContact.SetValue"; $contactID; "Note"; "Hello World!") ]
# required additional entitlements for FileMaker and may not work in macOS Ventura.

Sets the note field for a contact via AppleScript functions:

# Set Contact Note via AppleScript
Set Variable [ $theID ; Value: "773E1A42-ABCD-4CCF-88DE-E9C64BEE6D33:ABPerson" ]
Set Variable [ $theNote ; Value: "Best Hotdogs in town!" ]
# Compile AppleScript
Set Variable [ $ScriptID ; Value: MBS( "AppleScript.Compile"; "property theID : \"\"¶ property theNote : \"\"¶ tell application \"Contacts\"¶ set theContact to the first person whose id is theID¶ set note of theContact to theNote¶ save¶ return note of theContact¶ end tell" ) ]
Show Custom Dialog [ "Result from AppleScript" ; MBS( "AppleScript.LastError" ) & ¶ & MBS( "AppleScript.LastErrorMessage" ) ]
# run a query or multiple
Set Variable [ $r ; Value: MBS( "AppleScript.SetPropertyValue"; $ScriptID; "theID"; $theID ) ]
Set Variable [ $r ; Value: MBS( "AppleScript.SetPropertyValue"; $ScriptID; "theNote"; $theNote ) ]
Set Variable [ $result ; Value: MBS( "AppleScript.Execute"; $ScriptID) ]
Show Custom Dialog [ "Result from AppleScript" ; $result & ¶ & MBS( "AppleScript.LastError" ) & ¶ & MBS( "AppleScript.LastErrorMessage" ) ]
# free memory
Set Variable [ $r ; Value: MBS( "AppleScript.Close"; $ScriptID) ]

See also

Release notes

  • Version 10.2
    • Fixed CNContact.SetValue and related to accept numbers for date component values, e.g. to set birthday.

Example Databases

Blog Entries

This function checks for a license.

Created 1st August 2018, last changed 23th December 2023

CNContact.Name - CNContact.Show