Contact object in Salesforce represents a customer who is committed to buy OR has made at least one purchase already.
Required fields:
- LastName (required by Salesforce)
- Email (required by PowerSync)
- Magento Website (required by PowerSync)
Logic:
Primary goal is to find all customers where "Email" field matches an email address of a Contact in Salesforce OR if a Contact exist where Magento ID field matches the Magento ID field value of a customer in Magento.
Valid matches:
- Email Address match
- Magento ID match (Email could be different)
If "Per Website" account sharing settings in Magento are turned on, this implies that Magento may have duplicate customers in Magento, but each of those duplicates has to belong to one Magento Website. With "Per Website" scope, in addition to "Email" field Magento also MUST match "Magento Website" in attempt to identify a match.
Valid matches:
- Email address match and Website match
- Magento ID match (Email and Website could be different)
- Email address match and Website value is empty
Duplicate Found
If duplicate Contacts are found in Salesforce, Contact merge() should take place to ensure there are no duplicate Contacts in Salesforce system