In Salesforce flows, there’s a relatively new feature called “Update Existing Records”.

It’s only available in Create elements, and it allows you to update existing records instead of creating new ones. This effectively turns the create command into an upsert command. In plain English, this means “create this record if it doesn’t already exist”.

The first thing to consider is that the options to match existing records are very limited. They basically allow you to match on the record Id or the record name.

For example, if your flow creates contacts, you can set “Update Existing Records” to true and select “Name” as the matching criteria. This will ensure only one contact with this name exists. This also means if you want to create a contact with the same name but in another city, then you’re out of luck.

The second thing to consider is that it blindly updates all fields. Let’s imagine there’s a field on Contact called “Status”. When creating new contacts, the default is “Prospect”. At some point, you change this value to “Customer”.

Now in your flow that creates contacts, so you set Status to “Prospect”. In the Create element, if it finds a matching contact, it’ll change the Status back to “Prospect”. This may not be your preferred outcome.

The takeaway
While the upsert feature can be useful sometimes, use it with caution. Hopefully Salesforce will make it more robust in a future release.

Category:
Salesforce