Syncing records with StoreConnect IDs
On this page
To help with data sync between your site and StoreConnect, some standard and custom objects get a StoreConnect ID (SCID) appended to them when you install.
For standard objects where records are from the website, the SCID is added on creation. However, pre-existing objects don’t have a SCID, so won’t sync initially.
These non-SCID objects include:
- Account
- Contact
- Order
- Order Item
- Campaign Member
- Asset
- Lead
All other objects used by StoreConnect sync to and are made available to your website.
For organizations with large volumes of standard object records — such as millions of contacts — where only a subset are relevant to StoreConnect, you can also use per-record sync opt-in to control which individual records participate in synchronization.
Manually add SCID to a contact
When new records are created the SCID is populated automatically. When an existing object is updated the SCID gets added - except for contacts. For contacts, you can force add the SCID using one of the following methods.
- Invite a contact
- Trigger a password reset in the contact record
- Add a sync action shortcut
- In Bulk via Dataloader or any similar tool
Note: When you add a SCID to a contact, it also adds it to the primary account. This ensures that contacts are never synced without their account.
Method 1: Invite customer
- Go to the contact’s detail page in Salesforce.
- Find and select Send Invitation. An invitation email is sent to the contact with a link to set their password. The SCID is populated on the contact automatically.
See Invite customers to create an account for full setup details, including how to track invitation status.
Method 2: Initiate password reset
- Go to the contact’s detail page in Salesforce.
- Find and check the Reset Password option.
A password reset email is sent to the contact and the SCID is populated on the contact.
See Reset a customer password for more details.
Method 3: Add a quick action to add the SCID
Add the quick action:
- Go to Setup > Object Manager > Account (or any other desired object).
- On the sidebar, select ‘Button, Links, and Actions’.
- On the top right hand corner of the panel, select ‘New Action’
- Select Action Type ‘Lightning Component’.
- Select Lightning Component
s\_c:ApplyScIdActionWrapper. - Add a label, such as Sync to SC.
- Add the action to your contact page layout.
Use the quick action:
- Go to the contact’s detail page.
- Find and select the quick action Sync to SC. It will populate the SCID with a confirmation message.
You can add this quick action to any other record type if you want.
Method 4: Bulk update
If you have a lot of records to update, we recommend using a bulk action method.
- Use a tool like UUID Generator to generate multiple SCIDs at the same time. SCID’s must be 36 characters.
- Add these IDs to a CSV list of contacts.
- Import via Dataloader or similar.
See the eexample below for using APEX to generate and populate the SCID for your Contacts.
```text
/* How to generate a version 4 GUID (random)
- Generate 128 random bits
- Set the version: Take the 7th byte perform an AND operation with 0x0f followed by an OR operation of 0x40.
- Set the variant: Take the 9th byte perform an AND operation with 0x3f followed by an OR operation of 0x80.
- Convert the data to hex and add dashes */
public class GuidUtil { static List hexMap = new List { ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’ };
public static String newGuid() {
String randomStringAsHex = EncodingUtil.ConvertTohex(Crypto.GenerateAESKey(128));
String versionHexBits = randomStringAsHex.SubString(14,16); // 7th bit
String variantHexBits = randomStringAsHex.SubString(18,20); // 9th bit
Integer versionIntBits = convertHexToInt(versionHexBits);
Integer variantIntBits = convertHexToInt(variantHexBits);
Integer versionShiftedIntBits = versionIntBits & 15 | 64; // (i & 0x0f) | 0x40
Integer variantShiftedIntBits = variantIntBits & 63 | 128; // (i & 0x3f) | 0x80
String versionShiftedHexBits = convertIntToHex(versionShiftedIntBits); // Always begins with 4
String variantShiftedHexBits = convertIntToHex(variantShiftedIntBits); // Always begins with one of 8,9,a,b
String guid = randomStringAsHex.SubString(0,8) + '-' + randomStringAsHex.SubString(8,12) + '-' + versionShiftedHexBits + randomStringAsHex.SubString(14,16) + '-' + variantShiftedHexBits + randomStringAsHex.SubString(18,20) + '-' + randomStringAsHex.substring(20);
return guid;
}
static Integer convertHexToInt(String hex) {
Integer d0 = hexMap.IndexOf(hex.Substring(1,2));
Integer d1 = hexMap.IndexOf(hex.Substring(0,1));
Integer intval = d0 + (d1*16);
return intval;
}
static String convertIntToHex(Integer intval) {
// https://stackoverflow.com/a/13465128
String hs0 = hexMap.Get(intval & 15); // i & 0x0f
String hs1 = hexMap.Get(((intval >> 4) & 15)); //(i >> 4) & 0x0f
return hs1+hs0;
} } ```
```apex
@isTest public class GuidUtil_Test { @isTest private static void test() { Pattern p = Pattern.compile(‘[\w]{8}-[\w]{4}-4[\w]{3}-[89ab][\w]{3}-[\w]{12}’); for(Integer x = 0; x < 100; x++) { Matcher m = p.matcher(GuidUtil.newGuid()); System.assert(m.matches() == true); } } } ```
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.