Configuration of Preconditions
Just like a Workflow Post-Functions, they 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 then can be used in a later post function to decide, if that post function will be executed at all or not. Only post functions of JSU are supported (no out-of-the-box post functions from Atlassian or any post functions of other plugins).
Choose your Precondition
You have to configure preconditions in the same section as Workflow Post-Functions.
Thus as Jira administrator, you will choose and configure Preconditions similar to a Workflow Post-Functions:
Combine several Preconditions
You have to configure preconditions as separate steps in the workflow.
You can combine several preconditions with 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 opposit 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 preconditions 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 performed if the precondition is true.
- The post function should only 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, that 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. See also the sample screenshot above with steps 5, 6, 7, 8.
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, the other in case the precondition is false. This allows for a similar construct like IF / THEN / ELSE in classical computer programming.