2

I need to run flow from a record button. Record has Quantity__c (custom field). If 5 is entered in Quantity__c field then flow screen should loop through 5 times and then in final screen it should show all entered values and then finally it should insert 5 records.

How to achieve this in flow?

2 Answers 2

1

You are not really using a Loop correctly in that sense. A Loop is dealing with a collection of records. You are dealing with one record. Keeping in mind the limits on elements... depending on how many different quantity values you might have... you can try to use a bunch of Decision Elements to help feed it through. So you do your "#1", then send to a new decision to determine if you exit the Flow or proceed to "#2", and so on and so forth until you need to end. Not ideal. But, as I said, a Loop is for a collection of records, not a numeric field.

1

In order to build this flow exactly as you described, you need two InvocableMethod classes. The first accepts the Quantity__c input and generates a list of records to display on the screen, and the second accepts the list of populated record inputs and returns a string for a suitable list of records. Everything else about this is pretty mundane, but I wouldn't recommend this path except as a last resort. It'd be far less annoying to write it in Lightning or Visualforce.

You must log in to answer this question.

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