Jira expression validator

A huge number of potential use cases can be addressed by using Jira expressions which is currently a Cloud Only feature provided by Atlassian. Jira expressions can be a powerful tool but they come with limitations.

🛠️ Configuration

Notes

You can optionally enter a short Note (limited to 80 chars) and a longer Explanation (limited to 500 chars) to summarize what you are using the function for. This can help you differentiate multiple functions of the same kind in a single transition, as the Note will be shown in the workflow transition view.

Jira expression

Enter plain text and optionally use field codes, e.g. issue.summary, to insert field values. The result of the Jira expression shall return true or false.

Remember that the usage of field codes is different when being used in Jira expressions. Curly brackets surrounding the field code are not supported. Not for every field code known from the JWT Expressions an equivalent is available. 

Error message

Enter the message to show to the end-user when the validation fails. In case you don't enter a message, the default error Message for JWT for Jira Cloud "Validation failed for validator 'Jira expression validator (JWT)'" is displayed in case of a failing validation.

Special case: Validating specific fields in the Create transition with Jira Expressions

In the specific use case, when using a Jira expressions in a Create Transition to check if a value is empty, some fields require a different syntax than in normal transitions. We recommend using a Logical expression instead.

In the Create transition, a Jira expression to check if a value is empty has to be created as shown below for the following fields:

For example: 

Text field (multi-line)/Paragraph (supports rich text)

 ((typeof issue?.customfield_nnnnn == "Map") ? new RichText(issue?.customfield_nnnnn).plainText : issue?.customfield_nnnnn) != null

Other fields

 issue?.customfield_nnnnn != null


For all other transitions, this comparison looks like follows:

Text field (multi-line)/Paragraph (supports rich text)

((typeof issue?.customfield_nnnnn == "Map") ? new RichText(issue?.customfield_nnnnn).plainText : issue?.customfield_nnnnn) != ""

Other fields

issue?.customfield_nnnnn != ""

Test expression

We highly recommended to test your expression before publishing the workflow. Click on play_button.png and select an issue for the context of the evaluation of the given Jira expression. After clicking the "Run" button the result of the evaluation is shown in a message box below.

Learn more about how to test an expression!

To master Jira's expressions we strongly recommend reading the information we condensed on this single page. Especially when it comes to the difference between Jira expressions and JWT expressions.

📚 Use cases

Use case Workflow function Use case description
Block a transition based on the day of the week

Jira expression condition

Logical validator

Block transitions on weekends or any other day of the week.

This use case is valid for both conditions and validators. The only difference is that you can specify an additional error message when using a validator.

Check whether an attachment was added during the transition.

Jira expression condition

Jira expression validator

Make sure that the current user has uploaded a attachment during the transition. 

This use case is valid for both conditions and validators. The only difference is that you can specify an additional error message when using a validator.

Check if an attachment was added recently

Jira expression condition

Jira expression validator

Make sure that the current user has uploaded a attachment during a definite period of time.

This use case is valid for both conditions and validators. The only difference is that you can specify an additional error message when using a validator.

Block a transition if some issues under an epic are not in a certain status

Jira expression condition

Jira expression validator

Check whether an epic has all issues under it in a certain status.

This is particularly important if you want to block an epic as long as work is still being done on related sub-tasks.

This use case is valid for both conditions and validators. The only difference is that you can specify an additional error message when using a validator.

Block a transition based on issue links

Jira expression condition

Jira expression validator
Logical validator

Evaluate issue links and hide transitions based on the outcome.

This use case is valid for both conditions and validators. The only difference is that you can specify an additional error message when using a validator.

Validate worklogs

Jira expression condition

Jira expression validator

Evaluate if a user has logged more than a certain amount of time in the latest worklog.


Evaluate the Parent field

Jira expression condition

Jira expression validator

Evaluate different values of the issue in the Parent Link field of the transitioned issue.

This use case is valid for both conditions and validators . The only difference is that you can specify an additional error message when using a validator.

Validate an issue only if a comment is written during the transition

Jira expression validator

Evaluate the comments and block transitions based on the outcome.

This use case is only valid for validators as it involves making changes during a transition. An additional error message can be added.

Ensure all work for a release is completed

Logical validator

Make sure that a release can only proceed once all work items assigned to the same fix version have been completed.

This can be useful for release approval or deployment transitions where you want to prevent a release from moving forward while unfinished work is still associated with it.

Block a transition based on sprint information

Jira expression condition

Jira expression validator

Make sure that an issue is not in an active sprint.

This use case is valid for both conditions and validators . The only difference is that you can specify an additional error message when using a validator.

Prevent users from starting too many work items

Logical validator

Prevent users from starting too many work items at the same time.

Before a work item can be moved to In Progress, the validator checks how many other work items are already assigned to the same user and currently in the In Progress status category.

This can help teams keep work-in-progress under control and encourage users to finish existing work before starting additional items.

Check parent issue type

Jira expression condition

Logical validator

Check whether the parent of the current issue is of a certain issue type.

This is particularly important if you want to reuse a workflow for multiple sub-task issue types but only want a transition to be available if the sub-task belongs to a certain user story or a bug.

This use case is valid for both conditions and validators. The only difference is that you can specify an additional error message when using a validator.