Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
UI Text Box
sizemedium
typeinfo

This function returns the result of a given Jira expression as a text. In case a number, a list or a boolean logical value is returned by the Jira expression, the returned string text of the function jiraExpression() can be converted accordingly, e.g. with toStringList().

It unfolds its power when combined with JWT functionality which is not available in Jira expressions and vice versa.

Code Block
languagebash
titleSyntax
linenumberstrue
jiraExpression(textexpression) #Output: Text 
UI Expand
titleExamples
Parser expressionDescription
Code Block
languagebash
linenumberstrue
%{sort(distinct(toStringList(jiraExpression("issue.subtasks.map(s=>s.components.map(c=>c.name))"))),ASC)}

This example returns an ordered list of the unique component names of all sub-tasks of an issue, e.g.

Backend, Frontend, UI

To convert to text result, the following function is used:

Code Block
languagebash
linenumberstrue
%{Hi [~accountid:%{issue.project.lead}],
the user %{system.currentUser.displayName} has written 
%{jiraExpression("issue.comments.filter(c=>c.author.accountId==user.accountId).length")} comments to this issue and created %{jiraExpression("issue.subtasks.filter(s=>s.reporter.accountId==user.accountId).length")} sub-tasks.}

This example returns:

Hi [~accountid:557058:145e0473-5707-439c-80e4-1160dd57f114],

the user John Doe has written 3 comments to this issue and created 2 sub-tasks.



Code Block
languagebash
linenumberstrue
issue.project.lead = system.currentUser ?
     (toBoolean(jiraExpression("issue.votes == 0")) ? "This issue does not seem to be important for anyone" :                       
                   "There are voters for this issue!" ):
     "Not interesting for you!"

The function can also easily be used in a logical expression by converting the text result to a boolean logical value (by using the function toBoolean()):

If this expression runs for a user which is the project lead, this example returns :

There are voters for this issue! in case there voters for this issue 

This topic does not seem to be important for anyone if there are no voters for this issue.

In case the current user is not the project lead, only the message Not interesting for you!  is returned.

To achieve this the following functions is used:

UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
textexpression

Status
subtletrue
titletext

Any given text which can be evaluated as Jira expression.


(warning) The text expression is not checked for syntactical correctness when defining it in the parser expression editor.

UI Expand
titleOutput

This function returns a 

Status
subtletrue
titletext
 

UI Text Box
sizemedium
typeinfo

Variant where you can additionally define a list of issues which can be used within the the Jira expression given as the first parameter. You can access these issues through an injected context called issues.

Code Block
languagebash
titleSyntax
linenumberstrue
jiraExpression(textexpression, issueList) #Output: Text
UI Expand
titleExamples
Parser expressionDescription
Code Block
languagebash
linenumberstrue
%{sort(
     distinct(
            toStringList(
               jiraExpression("issues.flatMap(i=>i.subtasks).flatMap(s=>s.components).map(c=>c.name)",
               linkedIssues())),
  ASC)}

This example returns an ordered list of the unique component names of all sub-tasks of the linked issues, e.g.

Backend, Frontend, UI

To achieve this the following function is used:

You have to use flatMap because sub-tasks of a list of issues are returned as a multi list in a Jira expression.

Since the function returns a text, it is converted to a text list using toStringList().

Code Block
languagebash
linenumberstrue
toBoolean(jiraExpression("issues.every(c=>c.name=='UI')",subtasks()))

This example returns true  in a logical expression if all subtasks have a component UI

To achieve this the following functions are used:

Code Block
languagebash
linenumberstrue
toStringList(issue.components.leads) ~ system.currentUser AND        
  toBoolean(jiraExpression("issues.map(i=>i.issueType.name).includes('Task')",linkedIssues()))

This example returns true  in a logical expression if the current user is lead of at least one componnetall subtasks have a component UI

To achieve this the following functions are used:

UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
textexpression

Status
subtletrue
titletext

Any given text which can be evaluated as Jira expression.


(warning) The text expression is not checked for syntactical correctness when defining it in the parser expression editor.

issueList           

Status
subtletrue
titleissue list

Any given issue list. Usually this value is retrieved from a function (e.g. linkedIssues() or subtasks()).
UI Expand
titleOutput

This function returns a 

Status
subtletrue
titletext
 

UI Text Box
sizemedium
typeinfo

Variant where you can additionally define a string of Issue keys which can be used within the Jira expression given as the first parameter. You can access these issues through an injected context called issues.

Code Block
languagebash
titleSyntax
linenumberstrue
jiraExpression(textexpression, issueKeys) #Output: Text
UI Expand
titleExamples
Parser expressionDescription
Code Block
languagebash
linenumberstrue
%{sort(
     distinct(
            toStringList(
            jiraExpression("issues.map(i=>i.subtasks).flatten().map(s=>s.components.map(c=>c.name)).flatten()",
            "PU-2, PU-7, PU-120"))),
  ASC)}

This example returns an ordered list of the unique component names of all sub-tasks of the issues listed in the second parameter, e.g.

Backend, Frontend, UI

You have to use flatten because sub-tasks of a list of issues are returned as a multi list in a Jira expression.

Since the function returns a text, it is converted to a text list using toStringList().



UI Expand
titleAdditional information

Parameters used in this function

ParameterInput (data type)Description
textexpression

Status
subtletrue
titletext

Any given text which can be evaluated as Jira expression.


(warning) The text expression is not checked for syntactical correctness when defining it in the parser expression editor.

issueKeys

           

Status
subtletrue
titletext

A text with a comma-separated list of issue keys.
UI Expand
titleOutput

This function returns a 

Status
subtletrue
titletext
 

Page properties
hiddentrue

Status
Tech review

Status
colourGreen
titledone

Style guide

Status
colourYellow
titleReady for review

Status
titletodo
Status
colourYellow
titleReady for review
Status
colourGreen
titledone
Status
colourRed
titleflagged

Page properties
hiddentrue
Short description

Returns the result of a Jira expression.

Output

Status
subtletrue
titletext