All,
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
- Get
OpportunityLineItem
records withOpportunityLineItemSchedules
- If there's a related
OpportunityLineItemSchedules
record, then grab the MAX Schedule date record (SOQL syntaxSELECT Revenue From OpportunityLineItemSchedule ORDER BY ScheduleDate DESC LIMIT 1
) and store theRevenue
andOpportunityLineItemId
values into variables - Loop through all of the
OpportunityLineItem
records and assign theLast Period Revenue
value from theRevenue
variable we stored in the previous step - Lastly, update all
OpportunityLineItem
records 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.