Upsert Records and Partial Success in Flow : Yumi Ibrahimzade

Upsert Records and Partial Success in Flow
by: Yumi Ibrahimzade
blow post content copied from  Salesforce Time
click here to view original post



### Summary of Upsert Records and Partial Success in Salesforce Flow Salesforce Flow allows users to manage records in the Salesforce database, enabling actions such as retrieving, creating, updating, and deleting records. While Flow lacks a specific Upsert Records element, you can perform an upsert operation using the Create Records element by activating the Update Existing Records option. This process lets you update existing records or add new ones based on specific criteria. #### How to Upsert Records To upsert records in Flow, you can identify existing records using one of three options: 1. **Record ID:** Use the Salesforce record's unique ID. 2. **External ID:** Use an external ID field that must be unique. 3. **Standard Field:** Choose a standard field, like CaseNumber, designed for lookup. #### Handling Failures In the past, if one record failed during a mass create/update operation, all changes would be rolled back. However, with the Winter '25 release, Salesforce introduced a **partial success option** in the Create Records element. This functionality allows you to process remaining records even if some fail. - **Partial Success Option:** This feature enables you to continue with successful records while allowing for the tracking of write failures. If you attempt to create or update multiple records and some fail, the successful ones will still be processed, but the element itself will indicate failure. #### Limitations of Partial Success Despite its benefits, the partial success feature has limitations: - The Create Records element will still fail if any individual record fails, preventing the flow from continuing to subsequent elements. - There is no output to specify which records succeeded or failed, making it challenging to track data integrity. #### Example Scenario In an example where you upsert three Case records (two new and one existing), if one fails due to a validation rule, the successful processing of the remaining records will not indicate whether they were newly created or updated. This lack of clarity can complicate handling numerous records, especially in larger operations. #### Conclusion While Salesforce Flow's upsert capability and the partial success feature can be beneficial, users need to be aware of their limitations for effective data management. It is advisable to implement error handling, like fault paths, to ensure the smooth continuation of processes. ### Additional Context Understanding these capabilities is crucial for Salesforce administrators and developers looking to optimize data handling within their organization. Proper implementation can lead to more efficient workflows and improved data integrity. ### Hashtags for SEO #Salesforce #SalesforceFlow #DataManagement #UpsertRecords #PartialSuccess #SalesforceTips #CRM #SalesforceAdministration #Automation #DataIntegrity


Data elements in Flow allow you to interact with records in the Salesforce database. You can use them to retrieve, create, update, and delete Salesforce records. While these data elements are sufficient for most situations, there may be times when you need to upsert records as well. Although Flow does not have a dedicated Upsert Records element, you can achieve this using the Create Records element.

How to Upsert Records in Flow

When using the Create Records element to create multiple records from a record collection, you can enable the Update Existing Records option. This performs an upsert operation, which means updating existing records if they already exist and inserting new ones if they don’t.

There are 3 options to identify existing records.

  • Record ID: Use the Salesforce record ID to identify the record.
  • External ID: Select an external ID field from the record. This external ID field must be set as unique.
  • Standard Field: Select a field with its idLookup property equal to true. For example, CaseNumber.
Upsert Records in Flow

What to do if a create or update fails?

Previously, all data elements in Salesforce Flow operated on an all or nothing basis. This meant that if you attempted to create multiple records at once and even one failed, all the records would be rolled back. However, in the Winter '25 release, Salesforce introduced the partial success option in the Create Records element. Now, if a record fails to be created or updated, you can choose whether to proceed with the remaining records in the collection or roll back everything.

The partial success option is available only in the Create Records element. However, because this element supports upserting records, you can also use partial success when updating records. For example, if you need to update records, you can use the Create Records element and enable the Update Existing Records option to upsert them. Since all the records already exist in Salesforce, the Create Records element will update them instead of creating new ones.

Partial Success in Flow

Choosing the "Process successful records. Create or update only the records that are successful." option enables partial success. For example, if you attempt to create or update 100 records and 10 of them fail for any reason, the remaining 90 records will still be processed successfully.

Output of Partial Success

Although the upsert records and partial success options are useful, the output of partial success may seem incomplete.

If some records fail, the element itself fails as well, even though the remaining records are processed successfully. To handle this, you may want to use a fault path to ensure your flow continues smoothly.

Additionally, this element does not provide an output to indicate which records succeeded and which ones failed. This limitation can lead to missing or incomplete data tracking.

Example

Let's assume we have a Flow that upserts three Case records; two new records and one existing record. Below is the configuration used in this example.

Upsert Records 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.

Output of the flow

As you can see, there is no output indicating which specific record failed. Since we enabled partial success, the remaining two records were created or updated successfully. But again, we have no way of knowing whether the flow created two new records or created one and updated one. Now imagine handling hundreds of records. How would you track which ones failed or succeeded?

Furthermore, even though two records were processed successfully, the Create Records element itself failed because of the single failed record. As a result, the flow did not continue with the remaining elements.

While partial success can be useful in some cases, its limitations require careful consideration before enabling it in your Flow.

The post Upsert Records and Partial Success in Flow appeared first on Salesforce Time.


February 10, 2025 at 12:54PM
Click here for more details...

=============================
The original post is available in Salesforce Time by Yumi Ibrahimzade
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce