Versions Compared

Key

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

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 the long list of functionalities, the parser functions support setting and/or updating field values, issue filtering, date and time calculations, string manipulation and the execution of mathematical operations.

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.

Tip
All full list of supported functions can be found here: Expression Parser 201 - All functions


Main Features

The expression parser has two major core functionalities:

  • Extend accessibility to
    • issue
    • system
    • project
    • version
    • component
    • and user data through the use of Virtual Fields 
  • Provide a set of operators and functions to
    • read
    • filter
    • extract
    • manipulate
    • write
    • update related data

Field codes and usage

Excerpt Include
Field Codes and Usage
Field Codes and Usage
nopaneltrue

Virtual fields

Excerpt Include
Virtual Fields
Virtual Fields
nopaneltrue

Tip
All comprehensive overview of all available virtual fields can be found here


Expand
titleClick here to expand for a few examples...


Field NameField code

Value

Summary
%{issue.summary}

Issue Summary as 

Status
colourYellow
titleString

Description
%{issue.description}

Issue Description as 

Status
colourYellow
titleString

Assignee
%{issue.assignee}

User name of the Assignee as 

Status
colourYellow
titleString

Parent's assignee
%{parent.assignee}

User name of the parent's Assignee as 

Status
colourYellow
titleString
 

Number of votes received
%{issue.votes}

Status
colourBlue
titlenumber
 of votes received by the issue.



Info
titleRemember

Numeric 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.

Image Removed


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

There are multiple parsing modes available in the expression parser. The two most commonly used parsing

modes

are:
  • Basic: with this simple parsing mode you can write free text and insert field codes with format %{nnnnn} or %{nnnnn.i} anywhere in your text. These field codes will be replaced at runtime with the corresponding field values of the issue currently being processed
Advanced: with this parsing mode we can do much more complex text composition thanks to the usage of functions for replacing substrings, changing case, reading fields in linked issues, sub-tasks, JQL selected issues, and much more. It requires the text to be parsed to be written as string expression respecting the parser syntax.
  • Automatic parsing mode converter: You can write your text in basic mode, and then switch to advanced mode. The text to be parsed will be automatically rewritten as a string expression. Now, you can simply make the modifications you require, making use of text formatting functions, or inserting math or time expressions where needed.
  • 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 typeExampleBasicField 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 listMixed

    Field codes

    Parser Functions written in three curly braces

    String



    Div
    styleline-height: 150%;
    idtocContainer
    classtocContainer


    Panel
    borderColor#333f48
    bgColor#FFFFFF
    titleColor#eeeeee
    borderWidth1
    titleBGColor#333f48
    borderStylesolid
    titleOn this page

    Table of Contents
    maxLevel2
    indent20px
    classp