Update Related Record Using Salesforce Flow - A Complete Guide
Sometimes we have to update related object records. For updating the related object records we can use different methods but for now, we will use Flow. Flow is very helpful for updating the related object records.
How to Create Flow to Update Related Object Records
Step 1: Go to Quick Find Box and search ‘Flow’. And click on it.
Step 2: Click on the ‘New Flow’ button and select ‘Record Trigger Flow’ and click on ‘Create’. Here I update related records using ‘Record Trigger Flow’.
Step 3: Here I want to update ‘Industry Field on Account to Agriculture’ when a Contact is Created. So that I created one flow as -
- Object – Contact
- Trigger the flow on – A Record is Created
- Set Entry Condition – Account lookup field on Contact Should not equal to ‘null’.
- Optimize the flow for – Action and Related Records
Note - ‘Action and Related Records’ is used for action after the record is saved to the database. This means it is used for updating the related object records, sending emails and also for other actions.
Don't forget to check out: Explore Record Triggered Flow | Learn Salesforce Lightning Flows | Flow Builder Videos
Step 4: Use ‘Update Record’ as your element. And fill the information in it as -
- Label - Give a label to your ‘Update Record’ Element.
- Description – Give Description to your Element.
- How to find Records to update and set their value -
- Use the contact record that triggered the flow
- Use the IDs and all field values from a record or record collection
- Specify conditions to identify records, and set fields individually
Here I use ‘Specify conditions to identify records, and set fields individually’ because I want to update related records.
- Update Record of This Object Type – Select the object which you want to perform the update operation. Here I select ‘Account’ as my object.
- Filter Account Record - Here I use ‘All Conditions Are Met (AND)’ and match the id of the account record in the Contact lookup field. Which only update those Account record whose id present in Contact Lookup Field.
- Set Filed Value for Account Record - Here you have to set the value for the account field which you want to update and assign updated value accordingly. Here I use ‘Industry’ field and assign ‘Agriculture’ value in it.
Check out another amazing blog by Rajat here: Lookup Relationship in Salesforce - Here's All You Need to Know
Step 5: Click on ‘Done’. Hence your flow configures successfully now.
Step 6: Click on the ‘Save’ button which is a right corner. Now give the name to your flow and also give a description of it. And again, click on ‘save’.
Hence your flow saves successfully, Now clicks on ‘Activate’ to Activate your flow.
After creating a contact for a particular account then account industry filed updated to ‘Agriculture’ using this flow.
I hope this information will be helpful for you.