Update Child Records When There is a Change in Parent Record

salesforce record triggered flow

Record-Triggered Flow in Salesforce is one of the many types of Flows that you can use to automate your business processes. You can trigger the Flow when:

  • A record is created
  • A record is updated
  • A record is created or updated
  • A record is deleted

And run the Flow:

  • Before the record is saved
  • After the record is saved

With record-triggered flows you can potentially avoid writing triggers in some specific scenarios. Now you have the option of meeting complex business requirements without writing a single line of code.

Flow is the future of automation in Salesforce and is becoming increasingly powerful with every release. If you are still using Workflow Rules and/or Process Builders to build new automations in Salesforce, I urge you to switch to flows and avoid incurring technical debt. 

Spring ‘21 Release Update – Refer to the Prior Values of the Record That Triggered Your Flow

Now when an object’s record is updated, you can access that record’s earlier values in Salesforce Flow. The ‘$Record__Prior global variable contains the record’s values immediately before the Flow was run. You can use these values to check for changes in fields and calculate differences in your flow. This acts as an ‘ISCHANGED’ condition in Process Builder which we have made maximum use of in the past. So now you can take benefit of it in Flow and build logic around it. 

For this guide, we will be covering how to use the aforementioned ‘$Record__Prior global variable in Salesforce Flow. After going through this guide, within the next 20 minutes, you will learn how to: 

  • Create a Record-Triggered Flow
  • Save & Activate the Screen Flow
  • Test the Screen Flow

In this guide, we will be creating a Flow to update all the Contacts’ addresses when the related Account address changes. Earlier it could be done using Process Builder, but now you can incorporate it in your Flows using $Record__Prior’ global variable.

Want to download this PDF or watch a training video? We are now offering a complete course on Salesforce Flows called “Mastering Salesforce Flows”. To find out more about the course and watch a free preview, please click here.

References & Useful URLs: