Upserting Records in Salesforce Flow: Benefits, Challenges and Best Practices

Upserting Records in Salesforce Flow: Benefits, Challenges and Best Practices

In Salesforce Flow, data elements help you work with records in the database. You can use them to get, create, update, or delete records. Most of the time, these options are enough, but sometimes you may need to upsert records—meaning update existing ones or create new ones if they don’t exist.

Salesforce Flow doesn’t have a specific Upsert Records option, but you can still do this using the Create Records element.

How to Upsert Records in Flow?

When using the Create Records element to add multiple records, you can turn on the Update Existing Records option. This helps Salesforce check if a record already exists:

  • If it exists, it gets updated.
  • If it doesn’t exist, a new record is created.

To find existing records, Salesforce uses one of these three options:

  1. Record ID – The unique Salesforce ID of the record.
  2. External ID – A custom field marked as unique to identify records.
  3. Standard Field – A built-in field that Salesforce can look up

Article content

What should you do if creating or updating a record doesn’t work?

Before, Salesforce Flow used an all-or-nothing approach. This meant that if you tried to create multiple records at once and even one failed, all records would be canceled.

With the Winter '25 release, Salesforce introduced the partial success option in the Create Records element. Now, if some records fail, you can choose to:

  • Continue with the successful ones, or
  • Cancel everything like before.

This option works only in the Create Records element, but since this element also supports upserting (updating or creating records), you can use partial success for updates as well. If the records already exist, Salesforce will update them instead of creating new ones.

Article content

Selecting the "Process successful records. Create or update only the records that are successful." option enables partial success in Salesforce Flow. This means that if some records fail, the rest will still be processed.

For example, if you try to create or update 100 records and 10 fail due to errors (such as missing required fields or validation rules), the remaining 90 records will still be successfully processed.

Similarly, if you're importing 500 customer records and 20 contain incorrect email formats, only those 20 will fail, while the other 480 will be created or updated as expected.


Limitations of Partial Success Output

While upsert records and partial success options are helpful, their output can feel incomplete.

  • If some records fail, the Create Records element itself is marked as failed, even though the other records were processed successfully. To prevent this from disrupting your flow, you can use a fault path to handle errors smoothly.
  • The element does not show which records succeeded and which ones failed. This makes it difficult to track data accurately and may result in missing or incomplete information.

To overcome these challenges, consider logging failed records separately or using additional automation to track processing results.


Example

Imagine we have a Flow that upserts three Case records:

  • Two new cases that need to be created.
  • One existing case that needs to be updated.

Below is the configuration used in this example.

In this example, one of the three records failed due to a validation rule, and the error message is visible in the debug details.


Article content

As you can see, there is no output indicating which specific record failed. Since partial success was enabled, the remaining two records were successfully created or updated. However, there is no way to determine whether both records were newly created or if one was created and the other was updated.

Now, imagine processing hundreds of records—how would you track which ones succeeded and which ones failed?

Additionally, even though two records were processed successfully, the Create Records element still failed because of the single failed record. As a result, the flow did not proceed with the remaining steps.

While partial success can be beneficial in certain situations, its limitations should be carefully considered before enabling it in your Flow.

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics