Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,553,478
Community Members
 
Community Events
184
Community Groups

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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 15, 2021

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

Complicated situation, well handled 👍

0 votes
Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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
AUG Leaders

Atlassian Community Events