Workflow Preconditions
This is the JSU for Jira Server/Data Center documentation. If you are using JSU on Jira Cloud, see our JSU Cloud documentation.
Preconditions allow you to execute a post function under certain circumstances only; essentially they are conditions for the post function component of your rule. This allows you to create complex behavior on your post functions, enabling Jira to work harder for you.
JSU's preconditions are a part of the post function section in Jira's workflow configuration.
Configuration of preconditions
Like workflow post functions, preconditions are executed after the transition screen has been submitted (and all validators have passed). However, a precondition will not modify any data but perform a check similar to workflow conditions and workflow validators. The result of such a precondition can be used in a later post function to determine if that post function will be executed or not. Only JSU post functions are supported for JSU preconditions.
Choose your precondition
Preconditions are available in the list of post functions when adding a post function to a draft workflow.
JSU Preconditions include:
Date Compare
Date Expression Compare
Date Window
Fields Required
JQL
Linked Status
Regular Expression Check
Status Change
User Is In Any Groups
User Is In Any Roles
User Is In Any Users
User Is In Custom Field
Combine several preconditions
Preconditions are configured 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 are evaluated sequentially, as configured in the workflow. You can also negate the result of a precondition. 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.
Instead of negating the result of the precondition, you might also choose to perform the post function only if the precondition's result is false.
Enable your post function to consider preconditions
By default, post functions 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 should configure that post function accordingly. At the top of the configuration page of each JSU post function you can choose whether:
the post function should ignore the result of any precondition,
the post function should only be performed if the precondition is true, or
the post function should only be performed if the precondition is false.
Sequence of preconditions and post functions
All relevant preconditions must be evaluated before the associated post function, therefore, in the sequence of post functions/preconditions, you must 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 can all use the result of the last previously executed precondition. For example, you can 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 an IF-THEn-ELSE construct.