DataGroomr can check new data for duplicates before a record is created in Salesforce. The check uses the Real-Time Duplicate Check API: you send the values a user just entered, and DataGroomr returns the existing Salesforce record that matches, with a match score. A ready-made Salesforce screen flow that runs this check before it creates a Lead is available as an unmanaged package, DataGroomr - Lead Duplicate Check (Example Flow).
Duplicate prevention complements Live Dedupe and scheduled deduplication, which find duplicates after they are saved. Keep those running as well.
How duplicate prevention works
- A user enters the new record's values in a Salesforce screen flow.
- The Apex action Check For Duplicates (DataGroomr) sends the values and a Dedupe dataset ID to DataGroomr.
- DataGroomr compares the values with the Salesforce records in that dataset, using the dataset's Classic matching model.
- If a match is found, the flow shows the match score and a link to the existing record. If not, the flow creates the record.
Because Live Dedupe keeps the dataset up to date, the check also finds records that were saved only minutes earlier. Every improvement you make to how the dataset finds duplicates also improves what the check catches.
Requirements
- A DataGroomr account with access to Setup > API > API Keys.
- A Dedupe dataset for the object you want to protect, for example Leads.
- A Classic model selected as the dataset's Matching model. Live Dedupe can be enabled only for a primary Classic model.
- Live duplicate detection turned on for the dataset. Live Dedupe datasets count toward your plan's limits.
- Salesforce admin access to install a package and edit flows, credentials and permission sets.
Note: Install and test the package in a Salesforce sandbox before you roll it out in production.
What the package contains
| Component | Type | Purpose |
|---|---|---|
| DataGroomr - Unmanaged Lead Prevention Template (API name DataGroomr_Lead_Prevention_Template) | Screen flow | Lead entry form that runs the duplicate check before it creates the Lead. |
| Check For Duplicates (DataGroomr) | Apex action (class DataGroomrDuplicateCheck, plus the test class DataGroomrDuplicateCheckTest) | Sends the dataset ID and up to 10 field and value pairs to DataGroomr and returns the result. |
| DataGroomr API | Named Credential | Holds the DataGroomr API address, https://api.datagroomr.com. |
| DataGroomr API Credential | External Credential | Holds your API key in the principal DataGroomrPrincipal and sends it in the token header. |
| DataGroomr API Access | Permission set | Gives users access to DataGroomrPrincipal, so the flow can call DataGroomr. |
The flow has “Template” in its name, but it is not a Salesforce flow template, so it does not appear on the Templates tab in Flow Builder. The package is unmanaged: you can edit every part of it, and it does not receive automatic updates. The flow installs inactive.
Set up duplicate prevention
Complete the steps in order. Steps 1 and 2 are done in DataGroomr, and steps 3 to 7 in Salesforce.
Step 1: Prepare the Dedupe dataset
- In DataGroomr, open the Dedupe dataset and choose Edit Dataset from its actions menu.
- On the Match tab, select a Classic model in Matching model.
- On the Live Dedupe tab, turn on Live duplicate detection and click Save. DataGroomr confirms that Live Dedupe has been enabled and starts a full analysis of the dataset.
- Copy the dataset ID from the end of the dataset's URL (
/trimmr/Lead/<dataset ID>). You will need it in Step 5.
Step 2: Create an API key
- Go to Setup > API > API Keys and click Create API Key.
- Enter a Name, for example “Salesforce Duplicate Check”. In User, select the DataGroomr user whose access the API requests will use. Click Next.
- Click the eye icon and copy the whole token. It starts with your Org ID, followed by a pipe character (|).
- Save the token somewhere secure before you click Close. DataGroomr shows the token only once.
For more about API keys, see Integration API and secret keys.
Step 3: Install the package
- Open the package install link. If Salesforce asks you to log in, log in to the org where you want to install. For a sandbox, replace
login.salesforce.comin the link withtest.salesforce.com. - Choose Install for Admins Only, so that users do not see the flow before it is ready, and click Install.
- When Installation Complete! appears, click Done.
Step 4: Add the API key to the External Credential
The package does not contain your API key. Add it to the principal as an authentication parameter:
- In Salesforce Setup, search for Named Credentials and open the External Credentials tab.
- Open DataGroomr API Credential.
- Under Principals, click the arrow in the Actions column for DataGroomrPrincipal and choose Edit.
- Under Authentication Parameters, click Add.
- Enter ApiKey in Name, paste the full token into Value, and click Save. The principal now shows 1 authentication parameter.
- Under Custom Headers, check that the header named token has the value
{!$Credential.DataGroomr_API_Cred.ApiKey}.
The parameter name must be exactly ApiKey, because the header value refers to it. On the DataGroomr API named credential, keep Allow Formulas in HTTP Header selected; it is selected when the package is installed.
Step 5: Set the dataset ID in the flow
- In Setup, open Flows and open DataGroomr - Unmanaged Lead Prevention Template.
- In Flow Builder, open the Toolbox with the first button in the toolbar.
- On the Manager tab, under Constants, click Lead_Dataset_Id.
- In Value, replace
REPLACE_WITH_DATASET_IDwith the dataset ID from Step 1 and click Done. - Click Save.
Step 6: Assign the permission set
- In Setup, open Permission Sets and click DataGroomr API Access.
- Click Manage Assignments, then Add Assignment.
- Select every user who will run the flow, including yourself, and click Next.
- Choose an expiration option and click Assign.
Without this permission set, the call to DataGroomr fails and the flow creates the record without a duplicate warning.
Step 7: Activate the flow and add it to a page
- In Flow Builder, click Activate.
- Add the flow where your users create records, for example as a Flow component on a Lightning App Page, or as a Quick Action.
To try the flow before you add it to a page, open /flow/DataGroomr_Lead_Prevention_Template on your Salesforce domain.
Flow elements
| Element | What it does |
|---|---|
| Lead Details (Screen) | The entry form: First Name, Last Name, Company, Email, Phone, City, State/Province and Lead Source. Last Name and Company are required. |
| Check For Duplicates (DataGroomr) (Apex action) | Sends the dataset ID and the pairs FirstName, LastName, Company and Email. Accepts up to 10 pairs and skips blank values. |
| Duplicate Found? (Decision) | Reads the action's isDuplicate output. The Duplicate Found outcome goes to Possible Duplicate Found; No Duplicate goes to Create Lead Record. |
| Possible Duplicate Found (Screen) | Shows the match score and a View possible duplicate link. Previous returns to the form with the values kept; Next creates the Lead anyway. |
| Create Lead Record (Create Records) | Creates the Lead. |
| Lead Created (Screen) | Shows “Lead created: <name> (<company>)” and a View Lead link. |
| Lead Creation Failed (Screen) | Fault path. Shows the Salesforce error, for example when a validation rule or a field length stops the save. |
The record links use a short /<recordId> URL and open in a new tab, so the user keeps what they typed in the form.
Check For Duplicates (DataGroomr) action reference
| Name | Type | Description |
|---|---|---|
| Dataset Id | Input, required | The Dedupe dataset to check against. |
| Field 01 Name | Input | API name of a field, for example Email. Field 02 to Field 10 work the same way. |
| Field 01 Value | Input | The value to check for that field. Pairs with a blank name or value are skipped. |
| Apply Master Rule | Input, optional | Sends applyMasterRule to the API. The template leaves it empty. |
| isDuplicate | Output | True when DataGroomr returned a match. |
| matchedRecordId | Output | Salesforce Id of the matching record. |
| matchScore | Output | Match score as a percentage. |
| status | Output | completed when the check finished; error when the call failed; processing when the check did not finish in time. |
The action uses the first match that DataGroomr returns and waits up to 60 seconds for the answer.
Important: When the call fails, for example because the user lacks the permission set, the API key is wrong or Live duplicate detection is off, the action returns isDuplicate = false and status = error, and the template creates the record without a warning. To stop the user instead, add a decision on the status output.
Customize the flow
The package is a starting point. Your fields and processes will differ, so plan to adapt the flow.
Block duplicates instead of warning
By default the flow only warns: the user can still create the Lead. To block the record instead, do one of the following:
- In the Possible Duplicate Found screen, remove the Next button under Configure Footer.
- Route the Duplicate Found outcome to an end that does not create a record.
Change the fields that are checked
Change the Lead Details form to match how your team creates records, and update the field and value pairs on the Check For Duplicates (DataGroomr) action. Use the exact API names of the fields.
Send every field that the dataset's matching model compares. Fields you leave out lower the match score: the same Lead can score 58% with four fields and 85% with seven.
The action accepts up to 10 pairs. For more, add InvocableVariables to the DataGroomrDuplicateCheck Apex class.
Use the flow for another object
The Apex action works with any object. To protect another object:
- Point the Lead_Dataset_Id constant at that object's Dedupe dataset.
- Rebuild the form with that object's fields.
- Map its field and value pairs on the action.
- Change the Create Records element to that object.
Call the API from other systems
The flow is one way to call the Real-Time Duplicate Check API. Any system that can make an authenticated HTTPS call, such as a web form or an integration platform, can run the same check.
| Parameter | Description |
|---|---|
| Endpoint | POST https://api.datagroomr.com/v1/duplicates/check |
| Headers | token: your API token; Content-Type: application/json |
| datasetId | Required. The ID of a Dedupe dataset with Live duplicate detection on. |
| records | Required. Up to 100 records. Each record needs an Id that is unique within the request (any value, for example new-1) and the field values to check, keyed by field API name. |
| applyMasterRule | Optional, default false. When true, each match also returns selected_master_id: the Id of the record the dataset's master record rule would keep, which can be the Id you sent. Not supported for cross-object datasets. |
Example request:
POST https://api.datagroomr.com/v1/duplicates/check
token: <your API token>
Content-Type: application/json
{
"datasetId": "6939335050cd3286a1c6ba78",
"records": [
{
"Id": "new-1",
"FirstName": "John",
"LastName": "Doe",
"Company": "Acme",
"Email": "john.doe@acme.com",
"Phone": "(555) 010-0100"
}
]
}Example response:
{
"status": "completed",
"result": [
{ "record_id": "new-1", "master_id": "00Q5e00000AbCdEFGH", "score": 85 }
]
}record_id: the Id you sent for the record being checked.master_id: the Salesforce Id of the matching existing record.score: the match score as a percentage.- An empty
resultlist means no duplicate was found.
A request that cannot be processed returns HTTP 400 with a message. A wrong or deleted API key returns the message “Invalid token”.
HTTP 400
{
"error": { "id": "...", "message": "Record limit exceeded. Maximum allowed: 100." },
"status": 400
}If the check takes longer, the response has "status": "processing" and a correlationId. Get the result with GET https://api.datagroomr.com/v1/duplicates/check/result/{correlationId}. Results are kept for one hour, so stop polling after a few minutes. A check that fails while processing returns "status": "error".
API calls are limited to 60 requests per minute per organization. For the full reference, see the DataGroomr API documentation.
Limitations
- The flow protects only the entry point where it is used. Imports, the standard New button, API loads and other flows do not go through it. Keep Live Dedupe and scheduled deduplication running for those.
- The template uses one match, the first one DataGroomr returns, even when there are several.
- If the call to DataGroomr fails, the template creates the record without a warning. See the action reference above.
- No setup blocks every duplicate. For the best protection, limit the other ways users can create records and make all record creation call DataGroomr.
Troubleshooting
| Problem | Cause and fix |
|---|---|
| A user gets no duplicate warning, even for a known duplicate. | The call to DataGroomr failed and the action's status output is error. Most often the user does not have the DataGroomr API Access permission set. Also check that Live duplicate detection is on and that the API key is valid. |
| Live deduplication is not enabled for dataset: <dataset ID> | Turn on Live duplicate detection on the dataset's Live Dedupe tab. |
| No classic model is configured for dataset: <dataset ID> | Select a Classic model as the Matching model on the Match tab. |
| Invalid token | The ApiKey parameter on DataGroomrPrincipal is missing, incomplete (the Org ID before the pipe is part of the token) or belongs to a deleted key. The token header value must end in the exact parameter name ApiKey. |
| Record limit exceeded. Maximum allowed: 100. | Send no more than 100 records in one request. |
| Record at index N is missing Id, or Duplicate record Id | Give every record in the request an Id that is unique within that request. |
| The match score is lower than expected. | Send all the fields that the dataset's matching model compares. |
| The flow is not on the Templates tab in Flow Builder. | It is not a flow template. Find it in Setup > Flows. |
Remove the package
Deactivate the flow and remove the permission set assignments. Then go to Setup > Installed Packages and click Uninstall next to DataGroomr - Lead Duplicate Check (Example Flow). Uninstalling deletes the flow, both Apex classes, both credentials and the permission set.