What Does This Post Cover?
- How to use the Loop Element in Salesforce Flows
- When an update occurs on an Account object, make an update to ALL of the related opportunities.
In this example:
We will be walking through how to update all of the related Opportunities to an Account when the account rating is updated to the value of "hot". The reason WHY we want to use a loop is because potentially we could have thousands and thousands of opportunity records that may need to be updated every single day AND there potentially could be multiple opportunities related to the account. In this example, we are in no way going to assign that task to someone to update all of those opportunities manually. One, there is no way they could handle that volume, and two, we want this to happen quickly and instantaneously. We don't want to be waiting on a human to update these related opportunities. For that reason -- we will want to use a loop and a flow. It will make it instantaneous and nobody will be manually updating our related opportunities.
Since we have a video on this showing you step by step, this blog post will be primarily used to view the values we used in the video as a reference to rebuild.
#1 Account Process Builder
Node: "Update All Opportunities"
a. [Account].Rating = Hot
Immediate Actions: "Update Opps"
a. RecordId FIELD REFERENCE [Account].Id
#2 Loop Flow
a. Get Records: "Find All Opportunities"
b. Loop: "Loop Through Opportunities"
c. Assignment: "Assign Private Value"
d. Assignment: "Add to Collection"
e. Update Records: "Update All Opportunities"
#3 Video Walkthrough
Check out the FULL video walkthrough to get more context here in the youtube video below 🎬🍿