Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 9.3   9.4   9.5   10.0   10.1   10.2   10.3   10.4   10.5   10.6    Statistic    FMM    Blog  

CNContact.SetValue

Sets the value of a contact.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Contacts 8.4 Yes No No No Yes
MBS( "CNContact.SetValue"; ContactIdentifier; Selector; Value )   More

Parameters

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

Result

Returns OK or error.

Description

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.

Examples

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\" : \"home@test.de\" }, { \"label\" : \"My Label\", \"value\" : \"private@test.de\" } ]") &
// 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\"}") ]

See also

Example Databases

Blog Entries

Release notes

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

Created 1st August 2018, last changed 4th May 2020


CNContact.Name   -   CNContact.Show

Feedback: Report problem or ask question.




Links
MBS Xojo tutorial videos