This post-function is used for reading field values from issues selected by a JQL Query or an Issue List expression. The values read are written into a field in current issue.
We are going to set current issue's Priority with the highest priority among issues in the same project and with same issue type as current issue, which are also in statuses different from "Resolved" and "Closed":
JQL query used is: project = "%{00018}" AND issuetype = "%{00014}" AND status NOT IN (Closed, Resolved)
Note that:
Once configured, your post-function will look like this:
We want to add as new watcher into Epic issue the reporter or assignee of its task and sub-tasks using the following logic:
isInRole(^%{00006}, "Administrators") ? ^%{00006} : ^%{00003}
, where %{00006} is field code for Reporter, and %{00003} the one for AssigneefilterByPredicate(subtasks() UNION linkedIssues("is Epic of"), ^{00017} < {00017} OR ^{00012} < {00012})
, where {00017} is code for numeric value of Priority, and {00012} the one for Due date. Note that highest priority is 0The configuration for the described post-function is:
Text to be parsed is:
isInRole(^%{Reporter}, "Administrators") ? ^%{Reporter} : ^%{Assignee}
filterByPredicate(subtasks() UNION linkedIssues("is Epic of"), ^{00017} < {00017} OR ^{00012} < {00012})
Once configured, your post-function will look like this:
There are 3 types of source values available:
There are 2 different modes for selecting the issues whose field values are going to be read: JQL query and Issue List expression.
In this issue selection mode we use JQL, which is a language provided by Jira for doing advanced issue searching.
You can insert field codes with format %{nnnnn} in your JQL query. These field codes will be replaced with the values of the corresponding fields in current issue at execution time, and the resulting JQL query will be processed by Jira JQL Parser. This way you can write dynamic JQL queries that depend on values of fields of current issue.
Example: issuetype = "%{00014}" AND project = "%{00018}"
will return issues in same project and with same issue type as current issue.
When you write your JQL for selecting the issues, take into account the following advices:
summary ~ "%{00021}"
will return issues with current user's full name. As full name can contain spaces, we have written the field code between double quotes.issuekey in ("%{00061}")
will be rendered in runtime like issuekey in ("CRM-1, HR-2, HR-3"), which is syntactically incorrect. On the other hand, JQL Query issuekey in (%{00061})
will be rendered in runtime like issuekey in (CRM-1, HR-2, HR-3), which is correct.When we enter our JQL query, a syntax pre-checking is carried out in order to verify that it's correctly written. But when we insert field codes in our JQL query, the definitive form of the query that will be executed is unknown, since it depends on the actual values of the fields in runtime. In these cases the syntax pre-checking is done with speculative values given to the fields, and it might happen that fake syntax errors are reported.
In order to inhibit the JQL syntax pre-checking you should enter //
at the beginning of the line. Those characters will be removed in the actual JQL query that will be executed.
Example:
In this issue selection mode we use an issue list expression according to the Expression Parser. Here you can find Examples of Issue List expressions.