Flat 15% OFF starting from one instance! Sale Ends on 12 October 2025
Claim Now
Secondary Key Lookup
The plugin supports two types of key-based lookups to update existing records across both platforms (Salesforce and WordPress):
-
Primary Key Lookup: Uses the Salesforce Record ID stored in a WordPress field to identify and update the corresponding Salesforce record
-
Secondary Key Lookup: Useful when you already have existing records in Salesforce and corresponding WordPress records but there is currently no relationship among them and you want to update them based on a different matching field (not the Salesforce ID)
When to Use Secondary Key Lookup?
When records are synced using our plugin, the Salesforce Record ID is stored in the Primary Key WordPress field of the corresponding WordPress record.
However, if you have existing records in WordPress and Salesforce before setting up the sync, and the WordPress records don't have the Salesforce Record IDs of their corresponding Salesforce records stored, you can use the Secondary Key Lookup feature.
This allows the plugin to match and update records between the two platforms using an alternate unique field for matching, such as Email, External ID, or Username, that exists in both platforms.
How to Configure Secondary Key Lookup?
To enable secondary key lookup for bidirectional synchronization between WordPress and Salesforce, follow the below steps:
These instructions apply to both WordPress to Salesforce and Salesforce to WordPress sync directions.
Step 1: Enable Secondary Key Lookup
-
Navigate to the Object Mappings tab of the plugin
-
Create a new mapping or edit an existing one
-
Enable the Secondary Key toggle
Note: The Secondary Key Lookup will be applied for sync direction based on the Sync Direction toggles that are enabled.
Step 2: Configure Secondary Key Lookup Mapping
- Select the WordPress field to be used as the secondary key (e.g., Email, Username)
- Select the corresponding Salesforce field from the selected Salesforce Object fields
- Ensure that the chosen field contains unique values in both systems to prevent mismatches.
Note: The secondary key lookup can be configured for other WordPress objects like Posts, Pages & Custom Post Types as well.
Example Use Case: Using Secondary Key Lookup for Existing Records
Scenario:
I have some existing user records in my WordPress site and corresponding Lead records for those users in Salesforce. Since these records were created before the sync was set up, the WordPress records do not have the Salesforce Record IDs of their corresponding Salesforce records. This means the Primary Key lookup cannot be used to update these records.
However, both systems store the user's Email address, which acts as a unique identifier for matching records. To keep these records in sync, configure the Secondary Key Lookup to use the Email field in both WordPress and Salesforce for matching.
Perform the Object Mapping as shown in below image:
Below image shows WordPress User Record:
Below image shows Salesforce Lead Record:
Configuration for Secondary Key Lookup mapping:
- WordPress field: user_email
- Salesforce field: Email
When a WordPress user record is updated, it will trigger the sync, and the plugin will perform a lookup based on the Secondary Key Lookup mapping. This ensures that the corresponding record in Salesforce is updated rather than creating a new one.
For example, if the Website field in WordPress is updated, the change is synced to the corresponding Salesforce record.
WordPress Record After Updation:
Salesforce Lead Record after Syc:
For more information visit our Object Data Sync for Salesforce page or mail us at salesforcesupport@xecurify.com.