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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

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.

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

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