Author Topic: Delete records in AB not found in the Filemaker database?  (Read 1365 times)

juskaiser

  • Member
  • *
  • Posts: 8
Delete records in AB not found in the Filemaker database?
« on: September 23, 2014, 05:12:33 AM »
I'm trying to write a script that would delete records from address book that are no longer in in the filemaker database. To put things in context, I'm only worried about pushing contacts to my Address book, I'm not interested in pulling from there. All of my changes to my contacts are made either in Filemaker or in Filemaker Go and then pushed to address book.

I realize that it would probably be easier to delete the address book record at the same time it is deleted in filemaker via a script. However, this approach doesn't work well if the filemaker record is deleted on a mobile device with filemaker Go and then synced to my main database on my computer.

Essentially I'm looking for a way to check each address book contact's UID against all of the address book UID's for each contact record in my filemaker database. In the case that the UID exists in address book but not in the Filemaker database, it should automatically delete the contact from address book.

Do you guys have an example for something like this?

Chris Turner

  • Administrator
  • Member
  • *****
  • Posts: 28
    • Productive Computing, Inc.
Re: Delete records in AB not found in the Filemaker database?
« Reply #1 on: September 25, 2014, 09:35:45 AM »
I can see the difficulty in designing a way to clear records in AB that no longer have a match in FileMaker. The easiest method would be, as you said, to delete the Address Book contact at the same time as deleting the contact record. In order to adjust for removal of a record in FileMaker from FileMaker Go, you might want to use custom menus to override the Delete Record operation.

A possible implementation may be that the Delete Record operation (for a contact) stores the UID of the contact being deleted in a side table before deleting the contact from FileMaker. Then, when you perform your sync with Address Book and finish updating the contacts that are in both FileMaker and Address Book, you could add in a second process that checks the UID's of the deletion table and removes them from Address Book if they exist, clearing the deletion table of the UID's after handling them.
Chris Turner
Product Support Specialist
Productive Computing, Inc.