For the complete documentation index, see llms.txt. This page is also available as Markdown.

Build a resumable batch Flow

A batch job that stops halfway, for example because of a timeout or an error in an external system, should continue where it stopped when you run it again, without repeating work. This example sends a reminder email to a list of customers from a Flow action.

  1. On the object class you process, add a marker property, for example Reminder sent (Datetime), and a Reminder error (String) property.

  2. In the Flow action, use Read Objects with the filter Reminder sent has no value and Reminder error has no value, and set Limit result, for example 500.

  3. Add a Foreach over the objects read.

  4. Inside the Foreach, send the email. Then use Update Object to set Reminder sent to now, and Persist Objects for that object in the same iteration.

  5. Add a Catch Exception as the last node inside the Foreach, below the steps it should guard, and select Catch all (or the exception types you expect). When a step in the iteration fails, the steps after it are skipped and the Catch Exception runs. Inside it, map the message key of the error to an action variable with Result mapping, set Reminder error on the object to that value, and persist it. The Foreach then continues with the next customer, so one failing customer doesn't stop the run.

  6. Run the Flow again, or on a schedule, until the read returns no objects.

Because each customer is marked as soon as the email is sent, a run that stops halfway can be started again safely: it picks up only the customers that haven't been handled. Customers with Reminder error set are left out of later runs. Check them, then clear Reminder error to retry them.

Good to know

A Catch Exception only handles errors from nodes above it in the same block. If it is placed before the send step, a failed send isn't caught there, and the error goes up to the enclosing block.

Was this helpful?