Skip to content

Break

Type: break  ·  Package: Core Activities v1.0.8

Exits immediately the loop (For Each, For Loop or While) that contains it, without finishing the remaining passes. Execution continues with the activity that comes after the loop. Use it when you found what you were looking for or a condition makes further iterations unnecessary.

When it runs, it interrupts the nearest loop around it. It usually goes inside an If so it only exits under a certain condition.

  • It passes through the blocks between it and the loop: an If, a Try / Catch (it does not trigger the catch, but the finally runs) or a Retry (it does not count as a failed attempt).
  • It does not pass through an Invoke Playbook: a Break inside an invoked playbook does not exit the loop of the calling playbook.

None.

None.

This activity does not return a value.

Find the first row that meets a condition and stop:

For Each items = table itemVariable = row
└─ activities:
If condition = str(row["Status"]) == "Approved"
└─ then:
Set Variable name = found value = row
Break // found it: stop looping
Log message = "First approved: " + str(found["Number"])
MessageCause and fix
breakA Break ran with no loop around it (or inside an invoked playbook whose loop is in the calling playbook): the execution fails with that message. Move the Break inside the loop; if the invoked playbook needs to request the exit, return it as an output and decide in the parent.