Skip to main content
Skip table of contents

Writing expressions

You can always get autocompletion by typing Ctrl+Space if you are inside an input field.

How does it work?

When writing expressions, you can access and check various information available during the transition, for example, the transitioned issue, the project to which the issue belongs, or the user who is executing the transition.

You can access properties of these elements by using the . notation. For example, you can access the reporter of the issue with issue.reporter. Custom fields can be referenced by their id (issue.customfield_10143).

(info) A full overview of all possible types can be found in Atlassian's documentation.

Properties can be compared with other properties or fixed values using different comparison operators like ==!= or >.

You can combine different expressions with the logical operators && and || to check multiple expressions. Operations can also be surrounded by parentheses, which allows for more complex expressions.

On some elements, it is also possible to execute functions. These are based on the JavaScript syntax, so you can check whether a text includes another text or whether the issue contains a certain set of labels.

Expression Examples

Check that the issue has an assignee:

CODE
issue.assignee != null

Check that the issue type is either Story or Task:

CODE
['Story', 'Task'].includes(issue.issueType.name)

Check that the summary of the issue starts with refined or approved regardless of capitalization:

CODE
issue.summary.toLowerCase().match('^refined|approved') != null'

Check that all subtasks are in a status of the category Done:

CODE
issue.subtasks.every(subtask => subtask.status.category.name == "Done")

Check that there is a value for custom field customfield_10046 if the resolution is Duplicate:

CODE
issue.resolution.name != "Duplicate" || (issue.customfield_10046 != null && issue.customfield_10046 != "")

Check that the issue is labeled with needs-refinement:

CODE
issue.labels.includes("needs-refinement")

Check that the issue was updated within the last five days:

CODE
issue.updated > new Date().minusDays(5)

Check that there exists at least one issue link of type Blocks:

CODE
issue.links.filter(link => link.type.name == "Blocks").length >= 1

Check that the assignee was changed in the transition screen (only for validators):

CODE
originalIssue.assignee != issue.assignee

Check that the user executing the transition has the project role Developers:

CODE
user.getProjectRoles(project).some(projectRole => projectRole.name == "Developers")

Verify Expressions with Testing Console

Workflow Enhancer for Jira also provides you with a Testing Console which allows you to check your Jira expressions against the issues in a given project.

Screenshot from 2024-04-03 15-28-39.png

You can open the Testing Console by clicking to the button located under the textbox where you input your Jira expression.

After opening the Testing Console, you can select the project that you would like to test your expression on and click “Test expression”. Then you will see a table that shows the evaluation of your expression for each issue in the chosen project.

Screenshot from 2024-04-03 15-40-14.png

Each row corresponds to an issue in the chosen project, and the last column indicates the result of evaluating the provided Jira expression with the issue corresponding to that row.

Below you can find how to interpret each symbol that can appear in the Result column.

Result

Interpretation

(error)

The given Jira expression evaluates to false when evaluated on this issue

(tick)

The given Jira expression evaluates to true when evaluated on this issue

:error-icon:

There was an error in the given Jira expression, and as a result it could not be evaluated successfully.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.