Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5    Statistic  

Addressbook.record.SetValueForProperty

Sets the value of a given property for a record.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Addressbook 3.1 Yes No No No Yes
MBS( "Addressbook.record.SetValueForProperty"; RecordID; PropertyName; Value )   More

Parameters

Parameter Description Example value
RecordID The unique ID for the target person or group. $personID
PropertyName The name of the property. "EmailProperty"
Value The value as text, date or number. $value

Result

Returns OK on success and error on failure.

Description

Sets the value of a given property for a record.
For multivalue items, please use an empty string as value and the plugin will put in the current multivalue.
Possible property names are UIDProperty, CreationDateProperty, ModificationDateProperty, FirstNameProperty, LastNameProperty, FirstNamePhoneticProperty, LastNamePhoneticProperty, NicknameProperty, MaidenNameProperty, BirthdayProperty, BirthdayComponentsProperty, OrganizationProperty, JobTitleProperty, HomePageProperty, URLsProperty, CalendarURIsProperty, EmailProperty, AddressProperty, OtherDatesProperty, OtherDateComponentsProperty, RelatedNamesProperty, DepartmentProperty, PhoneProperty, AIMInstantProperty, JabberInstantProperty, MSNInstantProperty, YahooInstantProperty, ICQInstantProperty, InstantMessageProperty, SocialProfileProperty, NoteProperty, MiddleNameProperty, MiddleNamePhoneticProperty, TitleProperty, SuffixProperty and GroupNameProperty.

Examples

Set first name on a person:

MBS( "Addressbook.record.SetValueForProperty"; $personID; "FirstNameProperty"; Addressbook::FirstName )

Add a new URL to a contact:

Set Variable [$r; MBS( "Addressbook.multivalue.New") ]
Set Variable [$ID; MBS( "Addressbook.multivalue.addValue"; "http://www.mbsplugins.de"; "WorkLabel" ) ]
Set Variable [$r; MBS( "Addressbook.multivalue.setPrimaryIdentifier"; $ID ) ]
Set Variabel [$r; MBS( "Addressbook.record.SetValueForProperty"; $personID; "URLsProperty"; "multivalue" ) ]

Add work and home emails:

$r = MBS( "Addressbook.multivalue.New" )
$WorkEmailID = MBS( "Addressbook.multivalue.addValue"; Addressbook::WorkEmail; "EmailWorkLabel" )
$HomeEmailID = MBS( "Addressbook.multivalue.addValue"; Addressbook::HomeEmail; "EmailHomeLabel" )
$r = MBS( "Addressbook.multivalue.setPrimaryIdentifier"; $WorkEmailID )
$r = MBS( "Addressbook.record.SetValueForProperty"; $personID; "EmailProperty"; "multivalue" )

Set flags, so entry shows as company:

MBS( "Addressbook.record.SetValueForProperty"; $personID; "PersonFlags"; 1 )

Edit existing person:

# get an UUID for a person record
$personID = "637FA922-7A2B-4F9A-BFA3-023253D4A3D5:ABPerson"
# set a new name
$r = MBS( "Addressbook.record.SetValueForProperty"; $personID; "FirstNameProperty"; "John" )
# save it
$r = MBS( "Addressbook.save" )

Replace an email:

# find my ID
Set Variable [$personID; Value:MBS( "Addressbook.me" )]
# get email list
Set Variable [$r; Value:MBS( "Addressbook.record.valueForProperty"; $personID; "EmailProperty" )]
# show first email in list
Set Variable [$firstValue; Value:MBS( "Addressbook.multivalue.valueAtIndex"; 0 )]
Show Custom Dialog ["First Email"; $firstValue]
# replace first email with new email
Set Variable [$r; Value:MBS( "Addressbook.multivalue.replaceValueAtIndex"; 0; "test@test.test" )]
# show changed email
Set Variable [$firstValue; Value:MBS( "Addressbook.multivalue.valueAtIndex"; 0 )]
Show Custom Dialog ["First Email"; $firstValue]
# set back the email list
Set Variable [$r; Value:MBS( "Addressbook.record.SetValueForProperty"; $personID; "EmailProperty"; "" )]
# save it
Set Variable [$r; Value:MBS( "Addressbook.save" )]
Show Custom Dialog ["Saved"; $r]

Add first and last name:

Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "FirstNameProperty"; $vn )]
Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "LastNameProperty"; $nn )]

Set organization:

Set Variable [$result; Value:MBS ( "Addressbook.record.SetValueForProperty"; $personID; "OrganizationProperty"; $org )]

Add homepage URLs:

# add homepages
Set Variable [ $r ; Value: MBS( "Addressbook.multivalue.New" ) ]
Set Variable [ $Blog_URL_ID ; Value: MBS( "Addressbook.multivalue.addValue"; "http://www.mbs-plugins.com/"; "Blog" ) ]
Set Variable [ $Homepage_URL_ID ; Value: MBS( "Addressbook.multivalue.addValue"; "http://www.monkeybreadsoftware.de/"; "HomePageLabel" ) ]
Set Variable [ $r ; Value: MBS( "Addressbook.multivalue.setPrimaryIdentifier"; $Homepage_URL_ID ) ]
Set Variable [ $r ; Value: MBS( "Addressbook.record.SetValueForProperty"; $personID; "URLsProperty"; "multivalue" ) ]

See also

Example Databases

Created 18th August 2014, last changed 9th March 2018


Addressbook.personFromVCardTextRepresentation   -   Addressbook.record.UniqueID

Feedback: Report problem or ask question.




Links
MBS FileMaker blog