Create by Checking a Matching Record in Flow

Salesforce allowed us to check for a matching record in the flow create element with the Summer ’24 Release.
Single Record Create With Matching Check
If a matching record is found, you get to choose what happens. You can:
- Update the matching record
- Skip the matching record
It can also be determined what actions to take if multiple matching records exist. Options include:
- Update the most recently modified matching record
- Skip all matching records
It might seem that the definition of a matching record relates to the longstanding matching and duplicate rules in Salesforce, but this assumption is incorrect. The matching record is determined by the criteria you define in the create element. You can add multiple lines of criteria that you can combine with AND or OR. For example, a matching record can be found when the phone number AND the last name equal the values for the contact record you are about to create.

Can you use this to create/update a contact or a lead? Sure you can.
Single Record Limitations
Where else would this functionality be useful? For example, when you want to create a campaign member or a public group member record? Yes, that would be super helpful because Salesforce throws an error when a flow attempts to create a member record for a user or person who is already a member. What do we use in these scenarios? We add a get element first to see whether the record exists and then decide what to do using a decision element.
It’s important to note that junction objects are not supported. Since junction object records cannot be updated, a warning will appear if you attempt to activate this functionality for a junction object record like a group member. In theory, you should be able to use this functionality to skip the creation process and not attempt an update. However, if you try to apply this functionality to a junction object, Flow will generate an error.
Another caveat is that you cannot use custom logic when building the matching record criteria. Therefore, matching last name AND email OR last name AND phone is impossible.
Create Multiple Records With Matching Check
With Winter ’25, a similar functionality is supported for the create element with a collection of records. For this functionality, the choices are a little different. You get to choose the field to use to identify existing records. The choices are:
- Record ID
- External ID
- Standard Field: Select a field with the idLookup property equal to true, such as the Case Number field on the Case object or Email on the Contact object.
The decision also lies in your hands regarding actions if a creation or update attempt fails. Options include:
- Process successful records. Create or update only the records that are successful.
- Process no records. Don’t create or update records and roll back the transaction.

This functionality allows you to add records to Salesforce matching an external ID. You could find this handy if you use a separate marketing tool to generate leads for import into Salesforce, or an accounting platform that logs billing and payment activities into Salesforce. This feature mirrors the upsert functionality of other tools that import data into Salesforce.
Collection Limitations
Note that you don’t have a choice of what to do when there are multiple matching records here. The reason is that the element only expects to find one matching record. If it does, it throws an error. You would need to handle this via a fault path.
Explore related content:
Integrating the New Flow Action Button From Summer ’24
Top 12 Salesforce Summer 24 Flow Features
TrailblazerDX 2024 Unveiled: Salesforce’s AI Evolution and Data Cloud Frontier

4 Comments