Having issues with the number of iterations exceeded in a flow when I'm trying to save the AccountId as a text value in flow while looping a list of Opportunity records. Is there a way I can save directly the AccountdIds as text from the get Opportunity Elements?

1 Answer 1


If I'm understanding the question correctly, you are trying to Get an Account where AccountID is in the list of Opportunities. I believe you must have written the Get Statement inside the loop (collection of Opportunities) and hence you're getting the exception.

At this point in time, you can't use IN operator for Records. You can only use IN operator for Text/Number collection. Unfortunately, this won't meet your needs. Most likely in the next couple of releases, we will have IN operator for Record collection as well.

You may have to write an Invocable Apex method to pass OpportunityIds and get AccountIds returned. UnofficialSF has a package similar to this. Check it out here https://unofficialsf.com/get-records-in-flow-action/

  • Yes, that's exactly what I'm trying to do. It is weird that they deliver the IN functionality, but they make you create a loop to transfer the record variables to text variables.
    – ErFran
    Commented Nov 6, 2022 at 23:30
  • Lol..Yup. SObjects get stepchild treatment for a lot of features and in the past they attributed this to some kind of scalability issues that they are working on. Not sure what's the issue this time though
    – flowgician
    Commented Nov 7, 2022 at 5:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .