Plug-ins > Address Book Manipulator

Updating MV fields


I'm having problems with a script to update records in the Apple Address Book. Updating single value fields is no problem. The issue is with multi-value fields.

For example, in my Filemaker table - Contacts - I have fields 'Work Email Value' and 'Work Email Label' each with 3 repeats. In my update script I have lines such as:

Set Field [Contacts::gResult; PCAB_AddMV("E-Mail"; Contacts::Work Email Value[1];Contacts::Work Email Label[1])]

The problem is that this doesn't update the entry in the Apple Address Book - it adds another entry. So, for example, let's say the AB record has the email field entry:


When I run the update script, I end up with:


I guess I'm going to have to iterate through all existing entries in the AB to see if this email address already exists. But I can't work out how to do this.

Melinda DePalma:
In Apple's Address Book EACH multi value property (MV property) actually contains its own unique UID. If you want to update an existing MV property, then you will need to reference the specific MV property to update using the MV UID. For example try this instead:

Set Field [Contacts::Email 1 UID; PCAB_AddMV("E-Mail"; Contacts::Work Email Value[1];Contacts::Work Email Label[1])]

Please see screen shot below and it may also be beneficial to reference the FileMaker demo file that came with the plug-in for further examples.

Are there any special rules for looping though related records for Addresses and Email and Phone Numbers.

I've setup subscripts within a Contact Push Script to GTRR and loop though and push Addresses, Phone, and Email values to AAB, but am seeing errors. Do the values have to be stored flat in the Contact table for this to work?


[0] Message Index

Go to full version