0

I am very new to flows and I'm not yet still familiar with its workings. So I have flow that has a loop that supposed to iterate depending on the User's decision.

As you can see from the image below, after the creation of a custom object called "Delivery Note", I want to create multiple child objects called "Delivery Note Item" under it.

I was thinking that I could create a loop that will only terminate if I say I no longer want to create new Delivery Note Items. However, when I debug this flow, the loop will just end because the collection variable I set on the Loop is empty.

Most of the loops I see is that they first have a "Get Records" before the loop to add records to a collection and then use that collection to iterate the loop.

How can I do this when the Delivery Note Items are still to be created?

Thanks.

enter image description here

1
  • Is your question solved or do you need some more explanation? – Nina Rosen Oct 21 '20 at 9:02
4

Don't use the loop element, build the loop with the decision element :) enter image description here

I hope this helps :)

1
  • 1
    hi sorry for the late reply. Yes, this is a great help for us! Actually, this never occurred to me to not use a loop. Your solution is very elegant and I thank for this. XD – Jerard Dela Victoria Oct 21 '20 at 10:31
0

To avoid governor limits, don't put create records elements inside a loop. This will do the same thing, but be more scalable: Input screen > Assign to collection variable > Decision > return to input screen if yes, Create Records if no (outside the loop) > next step. The delivery note records you collect in the collection variable get written in one transaction at the end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.