Workflow Preconditions


Adapted definition from Wikipedia:

In Jira with JSU, a Precondition is a condition or predicate that must always be true just prior to the execution of a post function.

Configuration of Preconditions

Just like a Workflow Post-Functions, preconditions will be executed after the transition screen has been submitted (and all validators have passed). However, a precondition will not modify any data, but perform some kind of check similar to Workflow Conditions and Workflow Validators.

The result of such a precondition can be used in a later post function to decide if that post function will be executed or not. Only JSU post functions are supported for JSU preconditions.

Choose your Precondition

You have to configure preconditions in the same section as Workflow Post-Functions.

Combine several Preconditions

You have to configure preconditions as separate steps in the workflow.

You can combine several preconditions with a logical operator such as AND & OR. However, the concept of brackets is not supported. Instead, the preconditions will be evaluated sequentially, as they are configured in the workflow.

You can also negate the result of a precondition. Like this, if the check of a precondition was successful, the result of the precondition will be negated and result as false. In the opposite case, when the check of the precondition was not successful, but you negate the result, it will end up as: true.
This might give you some more flexibility in some cases. Instead of negating the result of the precondition, you might also choose to only perform the post function, if the precondition's result is false.

Enable your Post Function to be aware of Preconditions

By default, post functions are not aware of preconditions. They ignore any result of the preconditions.

If you would like a post function to be performed only if a precondition is true (or false), you have to configure that post function accordingly. At the beginning of the configuration screen of each post function from JSU, you will find a section like this:

Here you can choose, if

  • The post function should ignore the result of any precondition.

  • The post function should only be performed if the precondition is true.

  • The post function should only be performed if the precondition is false.

This feature is only available for post functions from JSU. Post functions of 3rd party plugins are not supported.

Sequence of Preconditions and Post Functions

Be aware that all the relevant preconditions must be evaluated before the post function, which relies on the result of those preconditions. Thus in the sequence of post functions/preconditions, you have to put the preconditions before the post function. If you use several preconditions, you must combine the result either with AND or with OR. Otherwise only the last (lowest in the configuration) precondition will be relevant.

You can use several post functions after a precondition. They all can use the result of the last previously executed precondition. Like this you can for example configure two post functions after your preconditions, one to be performed in case the precondition is true, and the other in case the precondition is false. This allows for a construct like IF / THEN / ELSE known in computer programming.