Dave Slusher

2 minute read

Much of the work for Flow Designer in the Madrid release has been towards achieving feature parity with Workflows. That is to say that any work that could previously be done in a Workflow could now also be done in Flow Designer. Here is one of those features.

Do Until Loops

This is a common bit of logic that is needed in any programming context, and now it is available in Flows. Conceptually it is simple - you define an exit condition with the condition builder and then a series of steps. The steps are executed and then the condition is checked. If the condition is true, the loop exits. If not, then the steps are executed again.

Typically the steps of the loop being repeated would include one of the new wait functions which would wait for a fixed time each iteration or possibly a relative time based on a value in one of the fields of the record. This is to prevent runaway execution of the logic of the loop.

For example, in the below example a full one day is waited between iterations of the loop logic. As in this case users are being asked for input, this makes sense. The logic of the loop could be calling an integration or orchestration type activity. In that case, it may make sense to wait minutes to guard against the transient failure of the network or API.

Example do/until loop with an exit condition defined

It makes sense to consider encapsulating any logic that could have transient failures (like integrations) in a loop like this with a pause in the middle. In the vast majority of the executions it will not actually loop at all but enter the first time, execute correctly and conclude the loop. However in this periods when an API or the network is temporarily unavailable, it will prevent bad data or unexpected results entering the system.

Conclusion

This is but one of the many exciting features in the Madrid release and specifically around Flow Designer. If you haven’t already upgrade your Personal Developer instance or claim a Madrid instance and explore these features. Happy developing!


Comments