🚀 Effective since April 2020 and JWT version 2.9.0 Automation Toolbox for Jira is fully integrated into our top rated app Jira Workflow Toolbox (JWT)🚀

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Introduction

The Automation Toolbox for Jira Expression Parser provides over 200 functions and operators to read, manipulate and filter data from Jira issues, users, groups, projects and more. Among others, the functions support setting and/or updating field values, issue filtering, date and time calculations, string manipulation and execute mathematical operations. An extensive set of operators provide the ability to write conditional functions, do validations with corresponding error texts, mathematical operations, and comparison expressions.

The expression parser has been in constant development since 2009 when it was first introduced in Jira Workflow Toolbox. Since that time, the expression parser has seen constant development, improvement, and extended functionality.

Main Features

The expression parser has two major core functionalities:

  • extended accessibility to issue, system, project, version, component, and user data through the use of Virtual Fields 
  • an extensive set of operators and functions to read, filter, extract, manipulate, write or update related data

Virtual Fields / Field Codes

Virtual Fields and their associated Field Codes, were created to a) provide workflows with data accessibility beyond the scope of normal Jira workflow processing and b) to insure data integrity throughout their use. In ATJ you can use Virtual Fields by searching for and picking their associated Field Codes in the dropdowns provided wherever a parser expression can be inserted. 

Please see the pages covering Field Codes and Usage and Virtual Fields for more detailed descriptions.

Below are a few examples of Field Codes. The full list of field codes is available here.

Sample string field codes (always preceded  by a % sign)

  • %{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.

Functions and Operators


Please use one of the following links for detailed descriptions of functions and operators.

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.


The Expression Parser Syntax Specification

Automation Toolbox for Jira uses a powerful expression parser for interpreting expressions with logical, mathematical, date-time and string-text terms.

This parser is a fundamental part of the app, and is used by various features in the app. The parser offers very similar functionality to the expression parser known to Jira Workflow Toolbox users. There are some differences, mainly in field code usage and the lack of ephemeral fields. 

You can use the provided parser functionality with a number of triggers, conditions, actions and selectors.      


The following is a simple example of parser usage for the Condition → Boolean Condition .

The condition will return true  if the issues Due date is greater than the current date.


The available Selectors, Conditions and Actions depend on the selected Trigger.

The syntax depends on the parser mode and the context of the rule. Therefore the following table explains the different parsing modes.


append the last comment to the issue desciption
#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.

ModeSupported featuresReturn typeExample
basicField 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