- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2020 02:20 PM
I created a Flow Designer SubFlow which uses a For-Each loop to add records to a table. That table has a business rule which aborts the action if a condition is not met. (It validates the data before allowing the insert.)
I have found that this breaks (stops the iteration) in my For-Each loop with an error. That's a terrible behavior, since many of the items I'm attempting to insert would pass validation (not trigger the Business Rule to abort the action) and would be inserted successfully. Is there any way to tell Flow Designer to ignore the aborted insert and try the next item in the list? Yes, I could add the same validation to an if condition in my loop in the flow, but it's very complex; and doing so would be a violation of the DRY principle in SOLID. (Don't repeat yourself, create a maintenance nightmare).
Trey Carroll
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 06:14 AM
I'm not sure how else to get around this other than doing the check-in the flow as well. Ideally, if you're doing something complex server-side you're doing that in a script include that you're calling from the business rule. You could then just call the same script include from an action in flow.
I haven't actually run into a business rule aborting an action affecting a for loop in flow to validate that so you might also check to see if the same thing happens in a PDI.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 06:14 AM
I'm not sure how else to get around this other than doing the check-in the flow as well. Ideally, if you're doing something complex server-side you're doing that in a script include that you're calling from the business rule. You could then just call the same script include from an action in flow.
I haven't actually run into a business rule aborting an action affecting a for loop in flow to validate that so you might also check to see if the same thing happens in a PDI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 07:52 AM
Hi Brad,
Thanks for the reply. That's a good thought, about having the if condition in the Flow call the same script include that the Business Rule checks when it evaluates its conditions.
I would still love it if you guys added a configuration to allow the loop to continue on an error. I would have to rewrite that business rule and move the condition check to a Script Include in order to follow the DRY principle. That would "cost me" all of the overhead of managing an Enhancement... (Code Reviews, Tests, recruiting Change owner, deployer, validator) as opposed to just clicking a magical "On error continue" button. I would call it the Flow Designer analog of a Try / Catch block. It seems like a logical extension of the capabilities of FD. As a very influential insider, maybe you could suggest it. 🙂
Regards,
Trey Carroll

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 08:02 AM
I will definitely pass it along. You should also create an idea in the idea portal for this if it doesn't already exist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2020 08:33 AM
aryIdeas.push(new Idea('On Error Continue for FD loops')); // I created the idea in the ideas portal
🙂 Thanks, Brad.