Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Issues using curly braces in JQL

Edited

Hello,

Im attempting to add an automation rule that will have a branch condition JQL to get issues in epics linked to the 'trigger issue'.

The JQL leverages ScriptRunner JQL functions and it includes the smart value of the trigger issue.
The problem is that the rule is failing on the JQL saying the curly brace used for the smart value is a reserved character and to put it in a string or use the escaped unicode value of '\u007b'.

An example of a functioning version of this jql is :

issueFunction in issuesInEpics(" issueFunction in linkedIssuesOf('key=CCFT-2', 'is implemented by') ") AND status != closed

Which in a JQL Branch condition would cleanly look like:

issueFunction in issuesInEpics(" issueFunction in linkedIssuesOf('key={{issue.key}}', 'is implemented by') ") AND status != closed

Below is my current 'version' of the JQL but it is continuing to fail.  I've tried numerous 'combination's of escapes to get this pass but have had no luck.

 issueFunction in linkedIssuesOf('key=\"{"\"{"issue.key\"}"\"}"', 'is implemented by') ") AND status != closed

Another failure failure showing how I had attempted the JQL using the unicode values.

CCFT-2: "(issueFunction in issuesInEpics(" issueFunction in linkedIssuesOf('key=\u007b\u007bissue.key\u007d\u007d', 'is implemented by') ") AND status != closed) AND (key != CCFT-2)" - Error in scripted function: issuesInEpics, see below, Error in scripted function: linkedIssuesOf, see below, Error in the JQL Query: The character '{' is a reserved JQL character. You must enclose it in a string or use the escape '\u007b' instead. (line 1, character 5)

How can I correctly format the JQL with escapes to get this JQL to work when triggered in the rule?

Version info:

Jira Server(not Cloud): 8.53

Automation for Jira: 7.2.8

ScriptRunner : 6.2.2

 

Thanks in advance for any help.

Regards,

Greg

2 answers

1 accepted

0 votes
Answer accepted

Thanks for the response @Curt Holley

You are correct for a single link i.e. a story linked in an epic your solution would work.
However, in my case Im looking for issues in epic with that epic linked to another epic.

the problem was with the jql string I was creating was having issues getting the correct escapes in place to manage the quotes and brackets.  So when I ran the query it failed.

I was able to solve this by using the string quoting of '/'.

I ended up with this and it is now working just fine:

// trigger issue and jql strings
def jqlPrefix=/issueFunction in issuesInEpics("issueFunction in linkedIssuesOf('key=/
def jqlSuffix=issueKey + /', 'is implemented by') ") AND status != closed/

// The JQL query you want to search with
final jqlSearch =jqlPrefix + jqlSuffix


I only got back to this task yesterday and came up with this solution and neglected to post here.   

I'll mark this as done/answered.

Thanks again,

Greg

Curt Holley Community Leader Apr 15, 2021

Right. I missed the epic linked to another epic part.

Complicated situation, well handled 👍

0 votes
Curt Holley Community Leader Apr 13, 2021

HI

I'm only familiar with the Cloud version of Automation, but ignoring my trigger/insert whatever trigger is relevant....wouldn't something like this work? plus no scriptrunner functions required.

idea.png 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

83 views 0 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you