Not new to flow at all but can't figure out a workaround for this.
I have what I believe to be a simple flow. It queries the
OpportunityLineItem object to see if a record has any
OpportunityLineItemSchedules records associated with it.
This is what I'm wanting the flow to do
- If there's a related
OpportunityLineItemSchedulesrecord, then grab the MAX Schedule date record (SOQL syntax
SELECT Revenue From OpportunityLineItemSchedule ORDER BY ScheduleDate DESC LIMIT 1) and store the
OpportunityLineItemIdvalues into variables
- Loop through all of the
OpportunityLineItemrecords and assign the
Last Period Revenuevalue from the
Revenuevariable we stored in the previous step
- Lastly, update all
OpportunityLineItemrecords in the collection with the variables specified
I'm hitting a
Too Many SOQL Queries 101 error. From what I gathered, it isn't best practice to have a get records element inside of a loop. What I'm trying to wrap my head around is how to overcome this. When I put the
OpportunityLineItemSchedules Get Records element outside the loop, it only grabs one record. When it's inside the loop, it grabs each record I expect it to, but errors out.
I've read I could implement a Pause element OR create another loop to get the
OpportunityLineItemSchedules. I'm trying to wrap my head around how to implement either of those solutions.
Wondering if I could get some guidance.