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
).
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.
Give me some examples, please…
Check that the issue has an assignee:
issue.assignee != null
Check that the issue type is either Story
or Task
:
['Story', 'Task'].includes(issue.issueType.name)
Check that the summary of the issue starts with refined
or approved
regardless of capitalization:
issue.summary.toLowerCase().match('^refined|approved') != null'
Check that all subtasks are in a status of the category Done
:
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
:
issue.resolution.name != "Duplicate" || (issue.customfield_10046 != null && issue.customfield_10046 != "")
Check that the issue is labeled with needs-refinement
:
issue.labels.includes("needs-refinement")
Check that the issue was updated within the last five days:
issue.updated > new Date().minusDays(5)
Check that there exists at least one issue link of type Blocks
:
issue.links.filter(link => link.type.name == "Blocks").length >= 1
Check that the assignee was changed in the transition screen (only for validators):
originalIssue.assignee != issue.assignee
Check that the user executing the transition has the project role Developers
:
user.getProjectRoles(project).some(projectRole => projectRole.name == "Developers")