Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Table of Contents

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.

...

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.

Image Added


Note

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.


Code Block
titleappend 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.

Code Block
titlesimple 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. 

Code Block
titleAdvanced 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.

Code Block
titleTime 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.

Code Block
titleCheck 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