I’m working with a list of customers in Salesforce, where duplicate detection is enabled for the phone field. When manually creating a new customer with an existing phone number, Salesforce displays a warning prompt asking if I want to proceed. The warning doesn’t block the save; it simply alerts me to the duplicate.
However, when attempting to insert a record with the same phone number using MAKE, I encounter the following error:
RuntimeError[400]: A duplicate record was found. Are you sure you want to create the record?
This indicates that the automation is being blocked due to the duplicate detection rules.
Solution Options
Here are a few strategies to address this and allow the record to be inserted:
- Modify Duplicate Rules:
- Adjust the duplicate detection rules in Salesforce to allow duplicates during API insertions.
- Go to Setup > Duplicate Rules, find the rule related to the phone field, and check the box for Allow Duplicates for Salesforce API.
- Bypass Duplicate Detection with a Custom Integration:
- Instead of using the standard duplicate detection rules, create a custom logic flow to handle duplicates.
- Use Flows or Apex to identify duplicates and decide whether to update an existing record or insert a new one.
- Pre-Validate the Data in MAKE:
- Add a step in your MAKE scenario to query Salesforce for existing records with the same phone number.
- If a match is found, update the existing record instead of trying to insert a duplicate.
- Override Warnings Using Upsert:
- Replace the Insert operation in your MAKE scenario with an Upsert operation.
- Upsert allows you to either update an existing record (if it matches a unique identifier like the phone field) or create a new record.
Best Practices
- Understand Business Requirements: Before allowing duplicates, confirm whether this aligns with your organization’s data integrity policies.
- Audit Changes: Ensure any adjustments to duplicate rules or integrations are thoroughly documented to maintain data governance.
- Test in Sandbox: Test these changes in a Salesforce sandbox environment to avoid unintended impacts on production data.
If you need help setting up any of these solutions, let Tectonic know!
🔔🔔 Follow us on LinkedIn 🔔🔔