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

Compare with Current View Page History

« Previous Version 4 Next »

parsing mode determines how the JWT for Jira Cloud expression parser interprets an expression. 

The available parsing modes depend on the context in which you use the expression. This means for example, that only the Logical mode is available if you configure a conditional execution in a workflow post function.

There are two parsing modes available in the expression parser:

  • General: you can write free text, insert field codes or use functions anywhere in your text. Field codes will be replaced at runtime with the corresponding field values of the issue currently being processed. Using functions for replacing substrings, changing cases, reading fields in linked issues, sub-tasks, JQL selected issues, and much more we can do much more complex operations. It requires the text to be parsed to be written as a string expression respecting the parser syntax which is described below.

The available modes depend on the context!

Please be aware that besides the JWT for Jira Cloud expression parser you can choose to use Jira expressions as a parsing mode in every context.

Multiple available parsing modes

Available parsing modes

Most functions will accept text values so casting values to text is a very powerful function

Additionally, you can directly transform a field value to text using the following syntax: %{...somefield}

Parsing modes overview
ModeSupported featuresReturn typeExample
General

Field codes

Parser Functions

Text  with the following restriction: the following combination  of characters has to be escaped by "\" when not being used as a field code field codes:   %{  →  \%\{

TEXT

The general parsing mode allows you to write functions to read and manipulate data from any issue in Jira. Field codes are supported as well as clear text.

simple text using a field code to read the summary
This is the issue summary: %{issue.summary}


Functions as well as Field codes have to be enclosed by %{...}. When you are nesting functions, only one %{...} is necessary. Within functions, texts have to be written in quotation marks. Quotes (") within a quoted text have to be escaped (e.g. "This is a \"quoted\" text" will result in This is a "quoted" text).

Advanced expression to read the issue summary and use a function to get the assignee mail address
%{"This is the issue summary: " + %{issue.summary} + " and the assignee mail is: " + userEmail(%{issue.assignee.email})

Please be aware that the general mode always return a text. In case this is used as an input for a number (especially date) parameter or as an issue list, JWT for Jira Cloud cares internally for a correct conversion.

Use mathematical operations:

Time to resolve the issue
%{{trigger.issue.resolutionDate} - {trigger.issue.createdDate}}

Working with issue lists

Time to resolve the issue
%{subtasks()}

Nested functions

Time to resolve the issue
%{count(subtasks())}

More complex example for a text which contains the current summary, the summary of the parent issue and the number of sub-tasks of the parent issue.

Time to resolve the issue
This is the issue summary: "%{issue.summary}" and that of the parent "%{parent.summary}". Issue %{parent.key} has %{count(subtasks(%{parent.key}))} sub-tasks.


An alternative expression, where the entire expression is written as one function, would be

Time to resolve the issue
%{"This is the issue summary: \"" + %{issue.summary} + "\" and that of the parent \"" + %{parent.summary} +"\". Issue " + %{parent.key} + " has "+count(subtasks(%{parent.key})) +" sub-tasks."}

The following combination  of characters has to be escaped by "\" when not being used as a field code or function delimiter:   %{  →  \%\{

Logical

Field codes

Parser Functions

BOOLEAN

The logical parsing mode shall return true or false. Field codes, functions and quoted texts are supported as well as comparison operators and logical connection. For details, please have a look at Logical expressions

Check if the assignee is equals the reporter
%{issue.assignee} = %{issue.reporter}

An example which uses functions and logical connectors

Check if the assignee is equals the reporter
%{issue.issueType} = "Epic" and count(subtasks()) > 0