Account Lookup (B2C PersonAccount)
PersonAccount object in Salesforce represents an individual (aka customer). PersonAccount is a B2C Account Record Type in Salesforce. Natively, Salesforce forces its users to only use B2B Accounts and assumes that people who use Salesforce are primarily do B2B business.
When PersonAccounts are activated in Salesforce, merchant does not have to use both an Account and a Contact, Contact is merged into an Account when makes a PersonAccount. "PersonAccount" is a feature that can be activated by SalesForce but CANNOT be de-activated - with makes the adaptation of that feature in Salesforce very low.
Required fields:
- LastName (required by Salesforce)
- PersonEmail (required by PowerSync)
- Magento Website (required by PowerSync)
IMPORTANT: PersonAccount does not have the "Name" field
Logic:
Primary goal is to find all Magneto customers where "Email" field matches an email address of a PersonAccount in Salesforce OR if a PersonAccount exists 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 a Website match
- Magento ID match (Email and Website could be different)
- Email address match and Website value is empty
Duplicate Found
If duplicate PersonAccounts are found in Salesforce, Account merge() should take place to ensure there are no duplicate PersonAccounts in Salesforce system