locked
CRM sync best practice RRS feed

  • Question

  • Hi guys,

    I have a theme for you all. It is about a best practice thing.

    Let's describe the problem first: let's say we have a contact and a list of emails (a 1 to n relationship). The contact entity itself contains a emailaddress1 field, field that will be displayed on the form. The email entity that is in a 1-n relationship with the contact has a is_primary flag. The behaviour that i expect is the following: when an email is created/updated as primary the emailaddress1 field of the contact should be changed accordly. Vice-versa, when the emailaddress1 field is changed the email entry from the list should be updated(or created as primary if nothing in the list)

    My solution: off course plugins that make this sync. The problem here is that we have recursion: an email become primary => emailaddress1 field is updated => that trigger the plugin to update the primary email from the list => trigger the plugin to update the emailaddress1 field and so on. My solution here was to make another entity that says if a specific entity should not trigger back. Seems to work but i don;t like it very much.

    So, if you faced this kind of recursion thing how did you fixed?

    Thursday, August 12, 2010 4:42 PM

Answers