This page will help you to get familiar with the powerful expression parser. We provide several use cases that will guide you to write simple expressions as well as high complex expression. To understand the expression parser, work through the sections on this page and you will be able to use it like a pro.
Introduction
The expression parser was written by Fidel Castro Amario starting 2009 for Jira Workflow Toolbox, 2017 acquired by us, Decadis AG. We are continuously improving and extending the parser together with the founder Fidel Castro Amario. We extracted the expression parser that we can now offer the functionality in certain Jira apps.
Main Features
The expression parser has two core functionalities. We use Virtual Fields to read and write issue fields and offer several functions to read, filter and manipulate data from Jira. After this section you will be familiar with the syntax how to write expressions.
Virtual Fields
The concept behind virtual fields is to make it possible to write several issue fields and virtual fields that are standard fields like the issue summary and fields that are not writable by default. You can for example trigger the execution of a transition using the virtual field "Issue Status" or add a new comment using the virtual field "New Comment".
Reading virtual fields to use their values to update other fields is possible with field codes. We support string and number field values. An example of a string field code is: %{issue.summary} and a number field code is {issue.dueDate}. Every feature in our app supporting expressions provide dropdown fields to search for the available field codes and insert the field code in your expression. So you don't need to remember the field codes. You always can search for the right field code.
Sample string field codes
- %{issue.key}
- %{issue.summary}
- %{issue.description}
- %{issue.assignee}
- %{parent.key}
- %{parent.summary}
Sample number field codes
- {issue.dueDate}
- {issue.createdDate}
- {issue.votes}
- {parent.dueDate}
Number field codes are only available for number fields, date/time fields and countable virtual fields. The full list of field codes is available here.
Functions
The expression parser provides over 200 functions to read, manipulate and filter data from Jira issues, users, groups and more. The functions support issue filtering, date calculation, string manipulation and more. A great set of operators allows you to write conditional functions, mathematical operations and comparison expressions.
The following list shows the overview of operators and function provided by the parser:
Operator
- Boolean operator
- Mathematical operator
- List operator
- Logical operator
- Conditional operator
Functions
- Issue data functions
- User, Group & Role functions
- Version functions
- Field history functions
- Selectable fields functions
- Mathematical functions
- Date-Time functions
- String functions
- String list functions
- Issue list functions
- Number list functions
- Cast functions
You can find all functions here.
Syntax
The expression parser syntax is as easy as possible to allow simple expression and complex ones. In example is is possible to update the description with the last comment as well as a high complex expressions to assign the sub-tasks of linked issues with link type "blocks" if their summary contains the string "alert" and the assignee is empty.
The syntax depends on the parser mode. Therefore the following table explains the different parsing modes.
#basic parsing mode %{trigger.issue.description} Last comment: %{trigger.issue.comment.last} #advanced parsing mode %{trigger.issue.description} + "\nLast comment: \n" + %{trigger.issue.comment.last}
Parsing modes
The Expression Parser offers you different modes to provide a flexible usage in certain places. You can calculate an issue due date depending on the current date or filter the issue sub-tasks by status to add a comment to those.
To update issue fields the parsing result will be cast to the expected value e.g. a user name will be cast to a user to update a user field like the assignee field.
Mode | Supported features | Return type | Example |
---|---|---|---|
basic | Field codes | String Object | The basic parsing mode supports the usage of field codes. Field codes can be used to access issue field values. simple text using a field code to read the summary This is the issue summary: %{trigger.issue.summary} |
advanced | Field codes Parser Functions | String Object | The advanced parsing mode has a defined syntax that allows you to write functions to read and manipulate data from any issue in Jira. Field codes are supported as well as clear text, written in quotation marks. Advanced expression to read the issue summary and use a function to get the assignee mail address "This is the issue summary:" + %{trigger.issue.summary} + " and the assignee mail is: " + userEmail(%{trigger.issue.assignee}) |
math/date time | Field codes Parser Functions | Number Date Date Time | The mathematical and date time parsing mode works like the advanced mode but expect a number as result instead of a string. The resulting number is used to updated numeric or date time fields. In case of date or date time fields the number will be cast to a date. Time to resolve the issue {trigger.issue.resolutionDate} - {trigger.issue.createdDate} |
logical | Field codes Parser Functions | true false | The logical parsing mode works like the advanced parsing mode but expression result must return true or false. Check if the assignee is equals the reporter {trigger.issue.assingee} = {trigger.issue.reporter} |
issue list | Field codes Parser Functions | issue list | |
string list | Field codes Parser Functions | string list | |
mixed | Field codes Parser Functions written in three curly braces | String |