Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation: Getting JQL error

Gisela Lassahn
Contributor
May 3, 2024

Hi everybody,

I'm using Automation in Jira Data Center with rule triggered by "Issue linked".

I've created an If-block with the following JQL:

{{issue.project}} not in (STCS, ITGOV) or {{issue.issuetype}} != Epic or {{destinationIssue.project}} not in (STCS, ITGOV) or {{destinationIssue.issuetype}} != Epic or {{destinationIssue.project}} = {{issue.project}}

I'm getting an JQL error saying:

Fehler in der JQL-Abfrage: Das Zeichen "{" ist ein reserviertes JQL-Zeichen. Sie müssen es stattdessen in eine Zeichenfolge einfügen oder das Escapezeichen "\u007b" verwenden. (Zeile 1, Zeichen 41)

Translated in English:

JQL query error: The "{" character is a reserved JQL character. You'll need to put it in a string instead, or use the "{" escape. (line 1, character 41)

What am I doing wrong and how should my JQL look like?

Many thanks for your help and best regards,
Gisela Lassahn

3 answers

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 3, 2024

Hi @Gisela Lassahn 

If I understand your question, the JQL statement you show is not valid. 

JQL statements have this syntax: some_issue_field OPERATOR some_value

For example: project IN (ABC, DEF)

Instead you are trying this: some_value OPERATOR some_other_value

For example: ABC IN (DEF)

And so there are no issue fields referenced, leading to the syntax errors.  (JQL is not a SQL, and so does not support those types of logical / comparison operations of data.)

 

Without knowing the specifics of the problem you are trying to solve, I believe you could either use Issue Conditions or Advanced Compare Conditions, testing the smart values with logical operators.

 

Kind regards,
Bill

0 votes
John Funk
Community Champion
May 3, 2024

Hi Gisela,

Try using just:

issuetype != Epic

it’s just JQL so you shouldn’t need the smart value there.

Gisela Lassahn
Contributor
May 3, 2024

Hi @John Funk ,

I could do this for the trigger issue, but not for the destination issue, or am I wrong?

John Funk
Community Champion
May 3, 2024

Correct. But the error is for character 41, which is before that. 

0 votes
Manoj Gangwar
Community Champion
May 3, 2024

Hi @Gisela Lassahn 

 

Could you please try the below JQL and check?

{{issue.project}} not in ("STCS", "ITGOV") or {{issue.issuetype}} != "Epic" or {{destinationIssue.project}} not in ("STCS", "ITGOV") or {{destinationIssue.issuetype}} != "Epic" or {{destinationIssue.project}} = "{{issue.project}}"
Gisela Lassahn
Contributor
May 3, 2024

Hi @Manoj Gangwar ,

I've tried your JQL but I'm still getting exactly the same error message.

In the message details I can see that my JQL is resolved to:
(key IN (ITGOV-66) AND (SmartProjectBean{source=Project{self='https://jira....

The "{" after "SmartProjectBean" is on position 41 and seems to cause the problem.

Gisela Lassahn
Contributor
May 3, 2024

@Manoj Gangwar ,

I've found workaround.

No I have two Smart Value Variables:

  • ProjectShortcut, defined as: {{issue.key.substringBefore("-")}}
  • DestinationProjectShortcut, defined as: {{destinationIssue.key.substringBefore("-")}}

Now I can work with these variables.

Many thanks to you for your time!

Gisela Lassahn
Contributor
May 3, 2024

@Manoj Gangwar :

Now I've got another problem.

My JQL now is:

"{{ProjectShortcut}}" not in ("STCS", "ITGOV") or "{{issue.issuetype.name}}" != "Epic" or "{{DestinationProjectShortcut}}" not in ("STCS", "ITGOV") or "{{destinationIssue.issuetype.name}}" != "Epic" or "{{DestinationProjectShortcut}}" = "{{ProjectShortcut}}"

The error message is:

... error running JQL: "(key IN (ITGOV-66) AND ("ITGOV" not in ("STCS", "ITGOV") or "Epic" != "Epic" or "UTK" not in ("STCS", "ITGOV") or "Story" != "Epic" or "UTK" = "ITGOV"))" - Feld 'ITGOV' existiert nicht., Feld 'Epic' existiert nicht., Feld 'UTK' existiert nicht., Feld 'Story' existiert nicht.
In English:

Field 'ITGOV' does not exist., Field 'Epic' does not exist., Field 'UTK' does not exist., Field 'Story' does not exist

Gisela Lassahn
Contributor
May 3, 2024

As I cannot create combinations of Issue Field Conditions connected with "OR" in an If-block (only with "AND"), I'm using an If-else-structure with else-if branches and Issue Field Conditions now and do the things in the else-branch instead of the if-branch.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events