Abort workflow

This is something you could approach in several ways, depending on what the child workflow does and how the main workflow should stop. Unfortunately your attached file contains just one workflow, so I can’t see what your intent is, but I would consider the following:

  • Is the condition exceptional? For example, a workflow expects some crucial UI element but it is not present, or an extracted string of text is empty where it must not be for the workflow to make sense. In cases like these it’s sensible to throw exceptions and/or, if using Orchestrator, mark a transaction as failed, because you want to be alerted and possibly adapt your workflow. The Throw activity can be used with an Exception type of your choice, or the Terminate Workflow activity with a Reason string, to throw a new exception, immediately ending execution unless caught at some point by a Try Catch.
  • The condition could also be unexceptional, for example a workflow checks for new files in a directory or new mail messages but none are found. In such cases it makes more sense to, for example, let a child workflow return an empty array and in the main workflow use a Decision to check for this, only connecting further activities to the appropriate path. The workflow then stops there in the other case, or you could connect this to a generic ending sequence where you log this result, close some applications, etc. It is necessary here, but also recommended in general, to use a Flowchart for the main workflow.

More on Exceptions can be found in Lesson 12 of the Academy Foundation training. More on throwing/catching exceptions on the forum:

1 Like