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

Does ScriptRunner Enhanced Search support nested issueFunctions?

Hi all: I'm trying to do something similar to Open Parent Issues with All Subtasks Closed but in JIRA Cloud, using ScriptRunner Enhanced Search.

Here's the accepted answer for ScriptRunner running on JIRA Server:

project = PROJECT and issuefunction in parentsOf("issuefunction in subtasksOf(\"issuefunction not in parentsOf('type in subTaskIssueTypes() and status != closed') and status != closed and type in standardIssueTypes()\") and status = closed")

Unfortunately, SRES doesn't seem to like this:

Error in the JQL Query: Expecting ')' or ',' but got 'not'. (line 1, character 45)

I thought it might be the backslashes to escape the ", as it seems SRES is less picky about that. But when I remove the backslashes, I get: 

Field 'issuefunction' does not exist or you do not have permission to view it.

My actual query is slightly trickier, requiring even more quotes, but I've tried all kinds of variations on single-quoting, double-quoting, alternating between the two, and I still have no luck:

project = PROJECT AND issuefunction in parentsOf("issuefunction in subtasksOf("issuefunction NOT in parentsOf("type='production release subtask' AND status != approved") AND type="production release" AND status != approved ") AND status = approved ")

Does SRES support this kind of deep nesting? This non-nested query below almost gives me what I want, but for some reason still returns a parent issue that has subtasks that are Approved and Done. I would like to only get parents where subtasks are all in Approved status.

project = PROJECT 
AND type = "production release"
AND status NOT in ("done", "completed", "canceled")
AND NOT issueFunction in parentsOf("type='production release subtask' AND status!=approved")
AND issueFunction in parentsOf("type='production release subtask' AND status=approved")

I appreciate any insights. Thank you!

2 answers

I thought I might try the "hack" of trying to reference a saved filter, but I cannot get this to work:

issueFunction NOT in parentsOf("type='production release subtask' AND status != Approved")

Error:

found "NOT in parentsOf(", was expecting "issueFunction in parentsOf("\

I don't know if you can normally have a filter like that.

But yeah, everything's a little bit different in Cloud. Can anybody from the ScriptRunner team weigh in?

Or since nesting seems like a no-go, does anybody have thoughts on why this non-nested filter would still return parents that have subtasks with a Done status?

project = PROJECT 
AND type = "production release"
AND status NOT in ("done", "completed", "canceled")
AND NOT issueFunction in parentsOf("type='production release subtask' AND status!=approved")
AND issueFunction in parentsOf("type='production release subtask' AND status=approved")

Hi Daryll,

I can confirm that we have resolved your issue through the support ticket which you raised in our support portal.

Regards,

Kristian

What was the solution?  I am running into the same issue trying to figure out how to get a nested query to work on Cloud. 

 

Looking to get:

1. All issues within an epic

2. All issues linked as "is dependent on" from that epic

3. All issues within epics from #2

 

Here is what I have for server that works:

(issueFunction in issuesinEpics("(issueFunction in linkedIssuesOf(\"issue=TEC-32919\", \"is dependent on\") AND issuetype = Epic)") OR issueFunction in linkedIssuesOf("issue=TEC-32919", "is dependent on") OR issueFunction in issuesInEpics("issue=TEC-32919")) AND status != Canceled AND type != Epic

 

This is what I'm trying with Cloud:

(issueFunction in issuesInEpics("(issueFunction in linkedIssuesOf("issue=TEC-32919", "is dependent on") AND issuetype = Epic)") OR issueFunction in linkedIssuesOf("issue=TEC-32919", "is dependent on") OR issueFunction in issuesInEpics("issue=TEC-32919")) AND status != Canceled AND type != Epic

 

Most of this function works with the exception of the nested query. 

 

Any help is greatly appreciated!

Like PhillipS likes this

I am in investigation of migrating to Jira cloud and having a similar issues with nesting issueFunctions inside one another.

 

issueFunction in linkedIssuesOf("issueFunction in epicsOf("<some native JQL Query>")", "Structure parent") 

 

The error I get is the same as one from the original post:
"Field 'issueFunction' does not exist or you do not have permissions to view it."

There is a work around posted on this forum:
https://community.atlassian.com/t5/Jira-Software-questions/Scriptrunner-issuefunction-within-another-issuefunction-s/qaq-p/1488870

That I am about to try out.  Basically, create the inner section as its own filter, and then nest that saved filter inside of the other filter you are trying to create.

I would assume the syncing time would potentially increase by 1x for each nested filter created (depending on the dependencies and what order they run in).  I'll let you know if it works out for me.

0 votes
Leonard Chew Community Leader Feb 02, 2020

I have checked your original query (the accepted solution) and can confirm that it works on jira-server. Your problem therefore seems to be cloud related or is a specific problem on your system.

Suggest an answer

Log in or Sign up to answer
TAGS

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