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 to use them, and the actions we can perform with 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 additional actions we can take to automate the process after the record is 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 creating the record trigger flow, in the Start element, select whether 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.

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.

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.

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.

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

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 objects: Job 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.

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.

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 these 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.

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.

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).

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.

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

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:
- Create and Use recordId Variable in Salesforce Flow
- Check if Get Records Is Empty in Salesforce Flow

Shubham is a Certified Salesforce Developer with technical skills for Building applications using custom objects, approval processes, validation rule salesforce flows, and UI customization. He is proficient in writing Apex classes, triggers, controllers, Apex Batches, and bulk load APIs. I am also familiar with Visualforce Pages and Lighting Web Components. Read more | LinkedIn Profile