Forums

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

ScriptRunner query within sub-query...

jurgenC
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 6, 2019

...or how to use "issueFunction in parentsOf" as a sub-query for  "parent in".

background:
the releases process is where there is the main issue (i.e. Release v1.3) and sub-tasks for releasing to environments (i.e. TEST, UAT, PROD).

object:
i would like to create a query that lists main issues where any of the sub-tasks are not closed and for those main issues, list the associated sub-tasks (irrespective of status).

currently i have following solution:
(issueFunction in parentsOf("project = \"Release Process Project\" AND type = Sub-task AND status in (Open)") AND summary ~ "Stock") OR parent in ("REL-26473")

i'd like to dynamicaly update "REL-26473"

the 1st section of the query returns "REL-26473" and substituting "REL-26473" in 2nd section with 1st section doesn't work:

(issueFunction in parentsOf("project = \"Release Process Project\" AND type = Sub-task AND status in (Open)") AND summary ~ "Stock") OR parent in ("issueFunction in parentsOf(\"project = \"Release Process Project\" AND type = Sub-task AND status in (Open)\") AND summary ~ \"Stock\"")

any idea or suggestions? thanks in advance!

1 answer

1 accepted

0 votes
Answer accepted
PD Sheehan
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.
November 6, 2019

Breaking it down ...

You want 

  1. All the parents of open sub-task matching certain parameters plus
  2. All the children (regardless of status) of the items in #1

So in JQL: 

issueFunction in parenstOf("query1") OR issueFucntion in subTasksOf ('issueFunction in parenstOf("query1")')

That may not be a very performant JQL, but this should work:

issueFunction in parentsOf("project = REL AND Type = sub-task AND status = Open AND summary ~stock") or issueFunction in subtasksOf('issueFunction in parentsOf("project = REL AND Type = sub-task AND status = Open AND summary ~stock")')

You might be able to speed it up by including a second project parameter in the sub-query

issueFunction in parentsOf("project = REL AND Type = sub-task AND status = Open AND summary ~stock") or issueFunction in subtasksOf('project = REL AND issueFunction in parentsOf("project = REL AND Type = sub-task AND status = Open AND summary ~stock")')
jurgenC
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 6, 2019

wicked, this works like a charm - thank you very much for your time and effort, very much appreciated!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events