Duplicate detection in flows

Increase the quality of your data by also using duplicate detection in flows. MSR-884 | May 2024

For whom is this feature?

This feature was developed for anyone who creates or edits accounts and contacts via flows.

Benefits for you as a user

  • You can now detect possible duplicates in the flow and then open an existing record

Clarification of this new feature

Within Salesforce, it is common practice to configure duplicate detection for a number of objects. You use the duplicate rules to specify what (combination of) fields you want to check for to see if they already exist. Users are immediately notified of this when entering data manually, but this does not work for (screen) flows. We have developed a new component for this which can check in advance whether the data in question will lead to a duplicate.

To use this functionality, add the new apex component ‘Check for Duplicates’ to your flow. This component has two parameters: 

  • 'Object for "record" input': this lets you specify in what object you want to create or edit a record
  • 'record': a single record variable of this object.

The result is an Apex-defined collection variable which indicates whether there are one or more duplicates. You can check the result with the Loop element to determine what existing record is retrieved with what duplicate rule. The following parameters are available:

  • duplicateObjectType: name of the object
  • duplicateRecordId: ID of an existing record of which a duplicate has been identified
  • duplicateRuleDevName: the name of the duplicate rule
  • IsDuplicate: Value True indicates that it is a duplicate
  • errorMessage: message as set in the duplicate rule
  • isAllowSave: specifies whether you are allowed to save the duplicate record. However, it is not possible in Salesforce to save a duplicate record in a flow, despite this setting in the duplicate rule.

If no duplicate is found, the collection variable will remain empty and you can create the record.

🔗 Here you can find the key features from the May 2024 Release