Start when another workflow fails or finishes
Run a workflow of your own when another one fails, or when it ends.
When another workflow fails
- In a new workflow, press Add a trigger, type
errorand choose Error. - Under Watch Workflow, choose a workflow, or All workflows.
- Add a step that tells you, such as an email.
- Press Publish.
In the step, use what failed:
{{trigger.workflow.name}}- The workflow that failed.
{{trigger.failedStep.name}}- The step that failed.
{{trigger.failedStep.error}}- Why it failed, the same as the run’s error.
{{trigger.run.url}}- A link to the failed run.
When another workflow finishes
Choose Run Finished instead. Under Run only when the watched run, choose Succeeded, Failed, or Finished (succeeded or failed). It starts on Succeeded.
Its data is the same, without failedStep: {{trigger.workflow.name}}, and {{trigger.run.status}} with the run’s other details.
Or name one in the workflow’s settings
In the workflow that may fail, open Settings in the builder’s left rail and choose an Error workflow. It runs when a run of this workflow fails, and gets the failure as its trigger data. It must be published.
If a failure is caught both ways, the error workflow still runs once.
What starts it, and what doesn’t
For the Error and Run Finished triggers:
- Starts it
- Production runs of the workflows it watches, in this workspace. It starts at once and never waits in line.
- Doesn’t
- Tests from the editor, a workflow run by a Sub-flow step (its caller’s run counts), its own runs, and runs an Error trigger or an error workflow started. A failed Run Finished handler still starts Error triggers.
The Error workflow setting also runs when a test from the editor fails, or when a workflow called by a Sub-flow step fails. It never runs for a run that an Error or Run Finished trigger started.
Check it worked
Make a production run of a live workflow it watches fail, such as with Run now… in Workflows. In Runs, a run of your workflow follows it, and shows Worked.
For developers
The triggers are errortrigger (on_error) and runfinishedtrigger (on_run_finished), with config.watch_workflow set to all or a workflow id, and config.on_status set to completed, failed or any. The setting is settings.errorWorkflowId. See Workflow definition.
Related
- Handle errorsStop, carry on, or run steps of your own · 4 min
- ErrorThe trigger’s fields and data
- Run FinishedThe trigger’s fields and data
Checked against 12d85b3b