Versions Compared

Key

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

How to use placeholders for JQL in JSU

Jira Query Language (JQL) allows you to do some advanced searching in Jira's search dialog. This is a very powerful feature provided by Atlassian in Jira. JSU extends JQL with additional placeholders, which will be replaced with the values of the current issue in transition.

...

The easiest way to write a JQL query for JSU is to prepare it first in Jira's standard search interface (use 'advanced search'!) with some sample value. Then copy it to JSU configuration and replace some of your sample values with {issue.FIELD NAME}s as required.


See JQL Use Cases for more examples.


Top tips

Fields on the current issue

Add the following to your JQL query:

Code Block
... AND key = {issue.key}

Fields on the parent issue

Code Block
... AND key = {issue.parent}

Fields on all sibling issues (other sub-tasks of the same parent issue)

Code Block
... AND parent = {issue.parent} AND key != {issue.key}
  • sub-tasks with the same parent: parent = {issue.parent}
  • excluding the current issue: key != {issue.key}


See JQL Use Cases for more examples.

Think careful about what might be the result of your query

JQL in JSU can be very powerful. However you also must think very careful, what values might be used as replacement for the {issue.FIELD NAME} placeholders. Or what happens, if an issue has no value on such a field. There could be quite some variety in the data of your issues.

(warning) If you are not careful, the result of such a JQL query unexpectedly might contain thousands of issue. Or the JQL query might fail, because the syntax has become invalid after the placeholders had been replaced.

JQL Injection

(warning) Further you must be aware of potential 'JQL injection':
JSU does not check any value which it retrieves from the current issue. A malicious user might craft the value of a field (for example the value of a text field), so that after the replacement it adds an additional criteria to your JQL query.

(info) We recommend not to use any text fields as placeholders. Or any other field, of which the user can freely change the text. Only use fields which can contain one/several of clearly defined values.

Syntax for Values of the current Issue

Replaceable value from issue must be between curly brackets like

{issue.FIELD NAME}

System Fields

Use the place holders from the following list:

...

  • {issue.Affects Version/s}
    Label in the english Jira user interface.
  • {issue.versions}
    Technical field id. See also reference from Atlassian .
  • {issue.affectedVersion}
    JQL's way to refer to that field.

Custom Fields

You can use either the name of a custom field, or it's id. For example:

...

(info) If you have several custom fields with the same name, you must use the custom field id.

Troubleshooting

In general it's a good idea to check your log files about any errors and warnings from JSU. Even more when you're using complex JQL queries in JSU.

...