Salesforce Flows: Before-Save and After-Save : Shubham

Salesforce Flows: Before-Save and After-Save
by: Shubham
blow post content copied from  SalesForce FAQs
click here to view original post



**Summary of Salesforce Flow: Before-Save and After-Save** In Salesforce, the record trigger flow activates when a record is created, updated, or deleted. You can choose to run the flow either before or after these changes happen. This article focuses on the differences between "before-save" and "after-save" flows, explaining when and how to use them effectively. **Before-Save Flow:** - This flow runs **before** the record is saved to the database. - You can only update fields on the same record; you cannot create new records, send emails, or access related records. - **Example:** If an account record has an annual revenue over $5000, set its priority to ‘High’ automatically. **After-Save Flow:** - This flow executes **after** the record is saved. - It allows for more actions, such as creating or updating related records, sending notifications, accessing record IDs, and calling subflows. - **Example:** If an account is updated to have a high priority, automatically send a notification to the customer. ### How to Implement: 1. Go to **Setup** > **Home Page** > **Quick Find Box** > **Flows**. 2. Create a new flow by selecting **Record Trigger Flow** and providing the necessary details. 3. Choose **Fast Field Update** for before-save or **Actions and Related Records** for after-save. ### Example Scenarios: - **Before-Save:** Automating the opportunity stage to ‘Closed Won’ if the opportunity amount exceeds $100K. - **After-Save:** Creating a record in the Candidate Profile object when an application is marked as shortlisted. ### Conclusion Understanding the differences between before-save and after-save flows in Salesforce is essential for effective process automation. By selecting the appropriate flow, users can automate tasks efficiently, whether updating fields or interacting with related records. --- **Additional Information:** - **Flow Setup Steps:** Ensure you configure entry conditions and triggers accurately to optimize your flow. - **Practical Applications:** These flows can significantly enhance efficiency in managing records and automating business processes in Salesforce. **Hashtags for SEO:** #Salesforce #SalesforceFlow #BeforeSave #AfterSave #Automation #CRM #ProcessAutomation #SalesforceTips


In Salesforce, the record trigger flow executes when a record is created, updated, or deleted. Additionally, we need to select when we want to run the flow, whether before or after the DML operation happens.

In this article, we will learn about the before-save and after-save in Salesforce Flow. In that, I will explain the detailed differences, when we need to use them, and which actions we can perform when using the before-save and after-save.

What is Before-Save in Salesforce Flow?

In Salesforce Flow, before-save means the flow runs before the record is saved in the Salesforce database.

Because the record is not yet saved, you can only update fields on the same record in a before-save flow. You cannot create new records, send emails, or access related records.

For example, when you create or update an account record with an annual revenue of more than $5000, you want to automatically set the account priority to ‘High’ on the same record.

What is After-Save in Salesforce Flow?

After-save in Salesforce Flow refers to the flow that runs immediately after a record is saved in the Salesforce database.

It is useful when you need to perform actions after saving the records, or the record already exists in the object.

Here, since the record gets saved in the Salesforce object, we can perform the following actions on the record:

  • Create or update other related records.
  • Send emails or notifications.
  • Access the record’s ID and use it in other actions.
  • Call subflows for further processing.

There are more actions that we can perform to automate the process after the record gets saved in Salesforce.

For example, when an account is created or updated with the account priority set to high, you want to automate the process and notify the customer by sending an email.

When we use Before-Save and After-Save in Salesforce Flow

When we create the record trigger flow, in the Start element, we need to select whether we want to run the flow before or after the record is saved. This step is the same for both options.

Let’s see the before-save and after-save in Salesforce Flow.

Click on the Setup. -> Home Page. -> In Quick Find Box, Search for Flows. You will see an option under Process Automation. -> Click on Flows.

In the flows setup window, click on the button New Flow -> Start From Scratch -> select the Record Trigger Flow -> Next.

When you select the Object, Trigger, and Entry Condition as you scroll down, you will see the Optimize Flow option.

There, you will have the following options:

  • Fast Field Update: This is used when you want to run a flow before the record is saved.
  • Actions and Related Records: This is used when you want to run a flow after the record is saved.
Salesforce Flows: Before-Save and After-Save

Example: Use Before-Save in Salesforce Flow

First, we will understand the scenario and then create a record trigger flow, utilizing the Fast Field Update (Before-Save) feature to automate the process with Salesforce Flow.

For example, the sales team wants to automate the process for the opportunity stages pipeline with the criteria:

  • If the Opportunity Amount is greater than $100K, the Opportunity Stage is automatically set to Closed Won.

On the record trigger flow, the Start element requires the following details:

  • Object: Select on which object are you creating the flow? In this case, the Opportunity object.
  • Configure Trigger: Select when the flow should get triggered (DML Operation). In this, an A record is created or updated.
  • Set Entry Condition: If the provided condition is met, the flow will only start executing.

After that, since we want to update the same object field and have no further action to perform in our example, we can select Fast Field Update.

Use Fast Field Update in Salesforce Flow

After that, click on the Add Element icon ‘+’ and select the Update Records element.

Provide the Label and assign the value to the field in the Set Values for the Opportunity Record.

  • I have assigned a Closed Won value to the opportunity Stage field.
Update Record Before Save in Salesforce Flow

After that, save the flow, debug it, and then activate it.

To verify that the flow is functioning correctly, navigate to the Opportunity object. If you select trigger flow when the record is created, then create the new record.

  • According to our scenario, if the amount exceeds $ 100K, the Stage should be automatically set to Closed Won when the record is saved.
salesforce flow update related records

As you click the Save button, the stage field value on the records detail page will be changed to Closed Won.

only when a record is updated to meet the condition requirements

In this way, we can utilize Fast Field Update in the record trigger flow to update the record before it is saved in Salesforce.

Example: Use After-Save in Salesforce Flow

In the first example, we learned how to update a field within the same object record. Now, we will learn how to use Actions and Related Records (After-Save) in record trigger flow.

In this example, we have two custom objectsJob Application__c and Candidate Profile__c.

When the applicants submit the applications, they will be stored in the job application object. The HR team will review the applications and shortlist the applicants for interview.

For the shortlisted candidates, we need to create records in the candidate profile object. That means we are creating records for different objects.

Create Record Trigger Flow. At the Start element, provide the details as follows:

  • Object: Job Application.
  • Configure Trigger: A record is updated.
  • Entry Condition: When the Shortlisted (checkbox) is set to ‘True’ (checked).

Here, when a job application is shortlisted, it means that the record has been updated in the Salesforce database; in this case, we want to create a record in the candidate profile.

For this, we need to select the “Actions and Related Records (After-Save)” option.

Create record Trigger Flow in Salesforce

Next, we need to add the Get Record element to create a record collection of job applications.

In the Object field, select the Job Application __c object that we created and the condition, if required. This condition filter records to optimize the flow.

Add Get Record Element in Salesforce Flow

Now, add Transform Element, where we transfer the record from the job application to the candidate profile object.

Provide the Label, and the API Name will be automatically populated. Next, we have two options: Source Data and Target Data.

  • Source Data(Where the data comes from):
    • This data or records we already have in the flow. Here we have a job application (record collection).
  • Target Data(Where the data will go):
    • Here is the candidate profile (object) records we want to create.

To select the source data, click the + icon and select the record collection variable that matches your data source.

Here, we have created a collection in the Get Record (Get Applications) section. You can see that after selecting the source data-related fields, they are also visible to map with the target data.

Next, click the + icon in the Target Data. There, we need to configure the resource.

Here, we want to create a record for a specific object. For that, in the Data Type select Record. Check the Allow multiple values and choose the Object to which you want to create the record.

Transform Element in Salesforce Flow

Next, we need to map the fields from the source data to the target data. For that, you need to select a field from the source data, and in the target data, with which field you want to map, click on that field.

Map fields using Transform Element in Salesforce Flow

After mapping the fields, we need to create the record for those that get transferred from the source to the target data.

To do this, add the Create Record element, providing a Label and API Name. After that, in ‘How to set record field values‘, we need to select ‘From a Record Variable‘. Because in the target data, we configured the resource to allow multiple values.

Then, in the Record Collection option, we need to select the transfer element (the label we provided to the transfer element).

Transfer records Using Transform Element in Salesforce Flow

After that, save the flow, debug it, and then activate it.

Now, navigate to the app where you added the custom objects and open the job application object. Then, open any application to shortlist.

I am updating Alex Anderson’s application, marking it as Shortlisted, and saving the record. Now the flow should create the record for this shortlisted applicant in the candidate profile object with the same field values.

Use Transform Element in Salesforce Flow

As you open the candidate profile object, you will see the record has been created with the values from the job application record.

Salesforce Flow Transform Element

In this way, we can use after-save in Salesforce Flow to perform operations on related objects, actions, or assign a task.

Conclusion

I hope you have got an idea about the before-save and after-save in Salesforce Flow. In that, I have explained the detailed differences, when we need to use them, and which actions we can perform when using the before-save and after-save.

You may like to read:

The post Salesforce Flows: Before-Save and After-Save appeared first on SalesForce FAQs.


July 20, 2025 at 04:31PM
Click here for more details...

=============================
The original post is available in SalesForce FAQs by Shubham
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