What is Salesforce Flow
Salesforce Flow is a tool used for automating business processes in the Salesforce platform. It allows users to create custom, guided processes that can interact with Salesforce data and other external systems.
With Salesforce Flow, users can create custom screens, input forms, and conditional logic to automate complex business processes. Flows can be initiated by a variety of triggers, such as when a record is created or updated, or when a button is clicked.
What is Record Triggered Flow
Record Triggered Flow is a type of flow in Salesforce that is initiated when a record is created, updated, or deleted. It allows users to automate certain business processes by defining a series of actions that should be taken when a specific trigger event occurs.
Scenario : –
Here’s an example of a record-triggered flow that Creates an Opportunity upon Account creation if Account active is equal to ‘Yes’ then only an Opportunity should be created related to the Account
Step 1: Create a New Flow
First, you’ll need to create a new flow. In Salesforce, go to Setup, then search for “Flows” in the Quick Find box. Click on “Flows” and then click “New Flow” to create a new flow.
Step 2: Choose Record Triggered Flow Type
In the new flow screen, select the “Record- Triggered Flow” option and give your flow a name.
Step 3: Select the Object to Monitor
Next, select the object you want to monitor for changes. In our example, we want to monitor changes to the Account object.
Step 4: Define the Trigger Conditions
Now it’s time to define the trigger conditions. In our example, we want to trigger the flow when the Account’s active field is equal to ‘Yes‘ then only an Opportunity should be created related to the Account. So we’ll add a trigger condition that says “When a record is created, and the Active field should be ‘Yes‘.
Step 5: Add an Action
You can see it is showing run immediately. So once your account record is created so this part will run immediately and automatically.
Once the trigger conditions are set, it’s time to add an action to the flow. In our example, So we’ll add a “Create Records” action to the flow. because we need to create an opportunity related to the account and account, we will be creating from the UI.
Step 6: Define the Field to Update
NOTE: Now, one thing you need to remember. So if you have gone through the screen flow scenario, so in screen flow, what do we do, we place our stream flow on the record page or do we launch it through the quick action. So in screen flow, if you want to receive the record ID of the record from where the flow is running.
So we use it to create recorded variables in the screen flow. But in the case of record flow, you don’t need to create a recorded variable to store the idea of the record through which the flow is initiated. It is available in this global variable that is known as the $Record (dollar record). So if you use this dollar record, so this dollar record will contain all the field information of the record through which this record triggered flow will be triggered.
Now we need to specify which field to update. In our example, we want to update a custom field on the Account record. So we’ll choose the custom field from the “Field” dropdown.
Step 7: Set the Field Value
Finally, we need to set the new value for the custom field. In our example, we want to set the value to the So we’ll choose $record account id from the “Value” dropdown for AccountId field, for CloseDate, build a formula and for StageName whenever any account record is created, so each opportunity will be having the stage name as prospecting or whatever you want to select in record triggered flow.
Step 8: Save and Activate the Flow
Once you’ve set up the flow, make sure to save it and activate it. Then, test it by creating a new Account with an active status. The flow should create a new Opportunity related to the Account accordingly.
That’s it! That’s how you create a record-triggered flow in Salesforce.