I worked as a Salesforce administrator. Recently, the sales manager has sought to automate the process of updating the opportunity stage, which is automatically set to ‘Closed Won’ when the amount exceeds $ 100,000. To do so, we utilize Salesforce Flow, a powerful automation tool.
In this Salesforce tutorial, we will learn how to create a record trigger flow in Salesforce. In this, we will discuss the following points:
- What is record trigger flow in Salesforce?
- When should we use record trigger flow in Salesforce?
- Example 1: Create a record trigger flow using Fast Field Update.
- Example 2: Create a record trigger flow using Action and Related Record.
What is Record Trigger Flow in Salesforce?
The record-trigger flow launches when a record is created, updated, or deleted. Typically, we use an Apex trigger to accomplish this task, but now we can also utilize the flow.
- The record trigger flow is an automated process that executes automatically upon record creation, update, or deletion.
- That means when the user performs a DML operation on records, the record trigger flow can perform further automation by using specified triggering conditions.
- The record trigger flow runs in the background and does not require user interaction.
The record trigger flow triggers when:
- A record is created.
- A record is updated.
- A record is created or updated.
- A record is deleted.
For example, when a new customer account is created, and we need to send an email to the customer about it, we can use a record trigger flow.
When Should We Use Record Trigger Flow in Salesforce?
- When we want to perform any automated task, that automation can be done with a record trigger flow.
- With the record trigger flow, we can avoid writing code in Apex triggers in some conditions.
- We can use Salesforce flows for automation and notification work.
- The record trigger flow updates the record ten times faster than the record change process.
Example 1: Create Record Trigger Flow using Fast Field Update
Using the Fast Field Update, we can only update the fields within the same object record.
For example, we want to automate a process where the sales team wants to automate the opportunity stages pipeline with the criteria:
- If the opportunity Amount is greater than $100K, the Opportunity Stage is automatically set to Closed Won.
We can create a record trigger flow in Salesforce using the above scenario and the following steps.
- Log in to the Salesforce Org. -> Click on the Setup. -> Home Tab. -> Search for Flows. You will see an option under Process Automation. -> Click on Flows.

- Click on the New Flow button to create a new flow. Then select Start from scratch and click on the Next button.

- We want to create a flow for automatically updating the field when criteria match. To do that, select the Record-Triggered Flow and click the Create button.

- In the Object field, select the triggering object. In our scenario, we need to create a flow on the Opportunity Object. In the Configure Trigger option, choose when we want to trigger this flow.

- In the Set Entry Conditions, we have to select the initial condition. When this condition matches our value, the flow will start to execute.
- In the Condition Requirements section, I selected the Amount value greater than 0. If this condition meets the record criteria, the flow will start executing.

- In our scenario, we are updating the same fields of the object. So, we have to select Fast Field Update, which is used when we want to execute the flow before the record is saved to the database.

- You can see the flow chart displayed with the selected option in the above steps.
- Add the decision element to check whether the entered amount is greater than or less than 100K.
- To add this element, click the ‘+’ Add Element option and select Decision Element. The decision element acts as an IF and ELSE statement.

- Enter the Label for the decision element; the API Name will automatically populate.
Outcome Details:
- Label: Enter a label for a condition like Check greater than.
- Outcome API Name: It will automatically populate as we click the text box.
- Criteria: I entered the IF Amount Greater Than 100000 per the scenario.
- Then click on the Default Outcome option and enter the details as we did in the above steps. You can define the logic according to your criteria by entering the resource, operator, and values fields.
- I’m not entering anything in the default outcome, so when the first condition gets true, the flow will execute accordingly; otherwise, it will stop.
Then click on the Done button.

- Now, when we want to update the opportunity stage field, we click on the Add Element icon ‘+’ and select the Update Records option.

- Enter 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 setting up all labels and conditions, click the Save button to save the flow.

- It is best practice in the flow to always debug it before activating, and then, if no errors occur, activate it.

Proof of Concept:
- 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 $ 100,000, the Stage should be automatically set to Closed Won when the record is saved.
- In the Stage field, I have selected “Value Proposition,” but when I click the Save button, the Stage field displays the value as “Closed Won.”

- After saving the record, the Stage field value on the detail page changes to ‘Closed Won’.

This is how we can create a Record Trigger Flow using a fast field update in Salesforce.
Example 2: Create Record Trigger Flow using Action and Related Record
Important: To update the related record, the associated objects must be in a relationship with each other, like a Lookup Relationship or Master-Details Relationship.
In the first example, we learned how to update a field within the same object record. Now, we will learn how to use the record trigger flow to update the fields of related objects.
Pre-requisite: We need an Active_c custom picklist field with Yes and No values on the standard account object.
- For example, whenever the Account’s Active_c field changes from Yes to No, all the opportunities related to that account that are in the Open Stage should change to “Close Lost.”
- Here, account and opportunity are in the lookup relationship.
- That means whenever an account’s active_c field changes from Yes to No, it will no longer be active, and its related opportunity stages, which are open stages, need to change to “Close Lost.”
Using the following steps, we can create a record trigger flow for Action and Related Records.
- In the Quick Find Box, search for Flow, click on Flows, and then click the New Flow button to create a new flow.
- Select the Record-Trigger flow. Then, click on the Create button.
- In our scenario, we are changing the account’s active_c field value. So, I have selected the Account object in the Object field.
- In Configure Trigger, I have selected A Record is Updated because the flow should trigger when we update the record.

- Then, we have to Set Entry Conditions, and in the Condition Requirement option, we have to select All Conditions Are Met(AND) because both conditions should meet the criteria.
- Here, the flow has to trigger only when the Active_c field value is No and when the user changes the Active_c value.

- In this scenario, we want to update the field of different objects after updating the record. For that, we will use Action and Related Records.

- To update a record in the related object. We need to click on the ‘+’ Add Element, then click on the Update Records option, and enter the following information.
- Label: Enter the label. This will be displayed on the flow canvas.
- API Name: This field will automatically populate after clicking.
- How to Find Records to Update and Set Their Values: Using this option, we can fetch records by related record ID. Here, I have selected specific conditions to identify records and set the fields individually.

- Now, on which related object record we have to update, enter that object name in the Object field. According to our scenario, I need to select the Opportunity object.
- Then, in the Filter Opportunity Records, we need to add conditions so that only records that meet the defined criteria will be updated. Here are the filtered conditions:
- First Condition: Opportunity.AccId = Record>Account>AccId.
- Second Condition: Stage Name not equal to Closed Won.
- Third Condition: Stage Name is not equal to Close Lost before updating the Active_c field on the Account object.

- Now we need to Set Field Values for the opportunity records, selecting the field you want to update from the opportunity object.
- Here, I want to update StageName, and this is the Picklist field so I can select a value in the value field.
- As per our scenario, we have to update the StageName to be equal to Close Lost.

- After setting up all labels and conditions, click the Save button to save the flow.

- Now, debug the flow. Then click on the Activate button; always remember before activating the flow, first debug it. It’s good practice to use flow.

Proof of Concept:
- To check how the flow is working, go to the Account object. Here, you can see that the Active field has a Yes value.

- When the Account Active field is set to Yes, you can see that all related opportunity records have different stages. Now, I will change the Active field to No, and you will see the changes in the next step.

- As I changed the active field to No, you can see all opportunities related to that account. The stages change to Close Lost, except for one opportunity, because we have added conditions to the filter opportunity fields that will not change.

This is how we can update related records using Record Trigger Flow for Action and Relate Record in Salesforce.
Conclusion
I hope you have got an idea about record trigger flow in Salesforce. We have seen the record trigger flow and when we can use it. Additionally, we have seen how to create record trigger flow in Salesforce with different scenarios and explanations.
You may like to read:
- Create Variables Using Flow Builder in Salesforce
- Create and Deploy Scheduled-Trigger Flow in Salesforce
- Update Related Records using Salesforce Flow
- Create Auto-Launched Flow In Salesforce
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.