Skip to content
Log in

Automated lead conversion to avoid duplication

On this page

To avoid duplicating account and contact records in Salesforce, StoreConnect checks to see if a customer already exists during checkout.

How automatic lead conversion works

Customers who have not yet checked out are treated like Salesforce ‘leads’. So at checkout, we try to match the customer ‘lead’ to an existing record.

If a matching ‘lead’ is found in your system, StoreConnect converts that lead to an existing account and contact. If one is not found, a new account gets created.

We match on first name and last name, and either email or phone. In the background, the lead is converted to an Account and Contact by assigning an account ID to Lead.s_c__Convert_Trggr_Acct_Id__c, which is then picked up by our StoreConnect APEX code.

:::note If your Salesforce environment has complex rules blocking contacts and accounts being created in your Salesforce org, then we will disable automatic lead conversion and this will be up to you to do manually. :::

What data is copied during lead conversion

Salesforce’s standard lead conversion first maps the lead’s own fields (email, phone, first name, last name, etc.) onto the newly created contact. StoreConnect then overwrites those values with the data the customer submitted at checkout — but only where the checkout value is non-blank. If the customer left a field empty at checkout, the value carried over from the lead is preserved.

The following fields are merged from the checkout session onto the converted contact:

  • Email
  • Phone
  • First name
  • Last name
  • Last login date
  • Password reset date
  • Invitation accepted date
  • Store ID
  • Username
  • Terms accepted date
  • SSO UID and provider
  • Confirmation URL
  • Reset password URL and flag
  • Send confirmation flag

The lead record itself is not deleted after conversion. It remains in Salesforce marked as converted (IsConverted = true) with the resulting contact and account IDs recorded against it.

The shipping address entered at checkout is saved to the order record only — it is not written back to the account record. Customers must log in and update their profile to persist a shipping address to their account.

Account and contact matching rules

The following sections outline the different treatments for different situations.

No account or contact record found

If the customer checking out does not have an existing Salesforce account and contact record, a new one will be created for them and associated to the order.

Existing contact with customer not logged in

If the customer checking out is not logged in to StoreConnect and uses an email address which matches an existing Contact’s email address within Salesforce, the Order will be created and associated with the existing contact.

If no matching email address is present, we query existing contacts for a possible duplicate using these Standard Salesforce matching rules.

If there’s no existing contact but there are possible duplicates, then the duplicate contact will be used, the order will be linked to the duplicate contact, but the order email will be sent to the email entered by the customer and any changes to shipping or billing address will be only saved to the order. To update their account or contact record, the customer must log in and update their profile.

If there’s no existing contact and no duplicates, then a new contact will be created.

Existing contact with customer logged in

If the customer is logged in, then all orders are directly associated with the existing contact and its account. The customer has the option to alter shipping or billing details during checkout, however, these are only applied to the current order.

The customer must log in to update their profile.

Existing account with customer not logged in

StoreConnect uses the existing account associated with the matched contact during checkout.

If the matched contact has no account then StoreConnect will query for existing accounts based on Person Account Matching Rule, even if your Salesforce Org does not use Person Accounts. This makes more sense than the Standard Account Matching Rules for StoreConnect’s use. If an account is found, then this is used for the order.

If there is still no account found, then we query again for duplicate accounts using the Standard Account Matching Rule.

If there’s no existing account, then a new account is created to be used for this order and the existing contact is assigned to this new account by StoreConnect.

We won’t use accounts that are ‘only possibly a duplicate’ as they may belong to another person. A new account is created instead using the email and name for the account name to prevent clashing with the possible duplicate Accounts, e.g. [jo.customer@example.com] Jo Customer. You can rename these accounts after creation if you desire.

Person accounts

If your Salesforce system has person Accounts enabled, StoreConnect creates an account and contact record that can be converted to a Person Account within your Salesforce org - but only if you set the account’s record type to Person Account either manually or via an automation. You can also make person accounts the default record type for syncing between StoreConnect and Salesforce.

Was this article helpful?

Was this article helpful?