Contact matching and lead conversion at checkout
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.
Lead conversion runs only when contact and lead duplicate resolution are both on for your store. In v22, automatic lead conversion does not work: the lead stays unconverted, and the customer ends up with both a lead and a new contact. See Turn duplicate resolution on or off for a store.
:::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:
- 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.
Some of these checks run only when duplicate resolution is on for your store: the possible-duplicate contact match, lead conversion, and the account lookups based on Salesforce’s standard matching rules. With it off, StoreConnect matches contacts and accounts on exact details only and otherwise creates new records. See Turn duplicate resolution on or off for a store.
Contact matching
Although the process is described as ‘lead conversion’, StoreConnect always looks for an existing Contact first. At checkout, the order of matching is:
- An existing contact that matches on email (optionally narrowed by first and last name).
- If no exact contact is found, a possible-duplicate contact using the standard Salesforce contact matching rules (first name and last name, plus either email or phone).
- Only if no contact and no possible-duplicate contact is found does StoreConnect look for a matching Lead (same first name, last name, and either email or phone) and convert it.
In other words, a lead is never used when a matching contact already exists.
If more than one Contact matches the same email address, StoreConnect uses the most recently created matching record and ignores the rest. It does not merge them. To consolidate duplicates, you’ll need to merge the records in Salesforce (see Merging accounts, contacts, and orders).
:::note Matching only considers records that already exist on the StoreConnect website side, that is, records that have synced from Salesforce. A contact or account created directly in Salesforce is not visible to checkout until it has synced. If a newly created record has not yet synced, checkout cannot see it and will match an older record that shares the same email instead. :::
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 more than one contact shares that email address, StoreConnect associates the order with the most recently created matching Contact. The selection is based on the created date — the newest record wins — and the other matching contacts are ignored.
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.
Account name when a possible duplicate exists
When StoreConnect detects a possible duplicate account but cannot confirm it belongs to the checking-out customer, it creates a new account rather than risk linking the order to the wrong person’s account.
To avoid a name clash with the possible duplicate, the new account is named using this pattern:
[customer@example.com] First Last
The email address is used as a namespace prefix. The customer’s actual name is stored in the Display Name field and is what appears on the storefront. You can rename these accounts in Salesforce at any time without affecting the website — StoreConnect uses the internal Salesforce ID, not the account name, to identify the record.
If you see accounts in this format in your org, it means StoreConnect encountered a possible duplicate during checkout and created a safe new account instead of guessing at an association.
Point of Sale (POS) contact matching
At the point of sale, StoreConnect identifies the customer differently from web checkout. The POS device keeps a local copy of your contacts synced from Salesforce and uses that to look up or create the customer at the time of the transaction.
How POS matches a contact
When a cashier assigns a customer to a POS cart, StoreConnect works through the following order of priority:
- StoreConnect ID match - if the cashier selects a customer from the contact search on the device, the POS passes the contact’s StoreConnect ID (
s_c__sC_Id__c) directly. If that ID matches an existing contact, that contact is used immediately with no further matching. - Email match - if the cashier enters the customer’s details manually, StoreConnect looks for a contact with a matching email address. The match is case-insensitive but must be exact. If both a first name and last name are provided, the result is further narrowed to contacts that match all three fields.
- Email and name duplicate match - if contact duplicate resolution is on for your store, StoreConnect also checks for contacts that match on first name, last name, and email.
- Phone and name duplicate match - if contact duplicate resolution is on for your store, StoreConnect also checks for contacts that match on first name, last name, and phone.
- New contact - if no match is found, StoreConnect creates a new contact record for the customer.
If more than one contact matches the same email address, StoreConnect uses the most recently created matching record.
Frontend duplicate detection
Before submitting a new customer to the backend, the POS device checks its local contact list. If a customer already exists with the same email address, the POS shows a “Customer Account Already Exists” prompt. The cashier can then choose to use the existing customer record rather than creating a duplicate.
This check runs against the local synced data on the device and does not require a live server request.
:::note The local contact list on the device is a snapshot synced from Salesforce. A contact created in Salesforce very recently may not appear in the local list until the next sync. If a contact is not found locally but exists in Salesforce, the cashier can use the remote search option, which queries the server directly. :::
Anonymous contacts
If a transaction is processed without assigning a customer (for example, a walk-up cash sale), StoreConnect associates the order with the outlet’s anonymous contact rather than creating a new contact record.
Turn duplicate resolution on or off for a store
StoreConnect sets whether duplicate resolution is on for your org. Three store variables override that setting for one store, so you can turn it on or off for that store without changing any other store in the org:
| Key | Controls |
|---|---|
duplicates.account.resolution |
Account matching at checkout and registration, at the POS (except for an account the register created itself), and through the API. With it on, StoreConnect looks for an existing account using the same criteria as Salesforce’s standard Person Account and Account matching rules before creating one. Your org’s own custom matching rules are not used. |
duplicates.contact.resolution |
Contact matching on the web and at POS. With it on, StoreConnect also matches a possible-duplicate contact on first name and last name, plus email or phone. |
duplicates.lead.resolution |
Automatic lead conversion. It runs only as part of contact resolution, so it has no effect while duplicates.contact.resolution is off. |
Each key takes enabled or disabled. Any other value, or no variable at all, leaves the org setting in place. The org setting is off unless StoreConnect has turned it on for your org. To find out what your org setting is, contact StoreConnect Support.
:::warning
In v22, automatic lead conversion does not work. Whenever lead duplicate resolution is on, whether through this variable or your org setting, the conversion fails and the lead stays unconverted, so the customer ends up with both a lead and a new contact. Set duplicates.lead.resolution to disabled to stop StoreConnect attempting it.
:::
- Open the Store record and go to the Store Variables related list.
- Click New.
- Enter
duplicates.contact.resolutionin Key. - Enter
enabledin Value. - Save the record.
- Repeat for
duplicates.account.resolutionif you also want account matching on.
The next checkout on that store applies the new setting. For example, with duplicates.contact.resolution set to enabled, a guest who checks out as Jo Customer with a new email address and a phone number already on a contact named Jo Customer is linked to that existing contact rather than to a new one. For the full list of variables and how to add one, see store variables.
Direct-to-cart links and the cid parameter
Direct-to-cart and buy-button links accept a cid parameter that identifies a contact by their StoreConnect ID. It is important to know that cid only pre-fills the checkout form — it does not attach the order to that contact and does not log the shopper in. The order is still matched using the email and name rules above, so passing cid does not protect against an email collision. To guarantee an order is associated with one specific contact, the shopper must be logged in for that checkout.
For full details and examples, see Direct to cart link.
Converting contacts to person accounts
If your Salesforce system has Person Accounts enabled, StoreConnect creates a business account and a contact for each new customer, then converts the pair to a person account. Conversion is on once the Person Account Conversion Record Type setting names your Person Account record type. Existing business accounts are not converted in bulk. For full setup instructions, see Using Person Accounts with StoreConnect.
B2B orgs and company-named accounts
In B2B setups where customers check out under a company name rather than their personal name, StoreConnect’s automatic account-linking logic may link a customer to an unrelated company account that happens to share a similar name and address.
To disable automatic account linking for guest checkout, set the Enable Company Name store variable on your Store record. When this setting is active, StoreConnect skips the account-matching step entirely and always creates a new account for each guest checkout. The customer’s existing account (if they log in) is still used for registered checkouts.
Contact StoreConnect support or your implementation partner to configure this setting if it is appropriate for your org.
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.