Hello everybody,
Need your help on writing ScriptRunner query with the the following requirements:
I need to find all Epics with Status Done or Rejected that have Open (not Done) Bugs or User Stories.
Readily admit that scripting is not my strongest suite, thus will greatly appreciate any help I could get.
Hi @Gregory Kremer,
You may use the below query (replace the bold text with your project key)
status != Done and type in (bug,story) and issueFunction in issuesInEpics("project = yourprojectkey AND status in (Done, rejected)")
Cheers,
Karim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Karim ABO HASHISH Sorry, one more favore. Could you please please let me know how the query would look like if I wanted to list all Done, Rejected Epics with not completed Bugs and User Stories? I'd greatly appreciate it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not the right answer. Misread original post. This gets child issues based on a filter for Epics. Poster asked for Epics based on filter for child issues. That answer is supplied later in this Answer thread.
Hello @Gregory Kremer
You can do that using the ScriptRunner Enhanced Search option under the Apps menu.
This is the function you need:
https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/jql-functions
issueFunction in issuesInEpics("project = <yourProject> AND status in (Done,Rejected)") and issueType in (Bug, "User Story") and statusCategory != Done
Breaking this down...
1. This part says which Epics you want to select
("project = <yourProject> AND status in (Done,Rejected)")
2. This part says get all the child issues of these Epics
issueFunction in issuesInEpics
3. This part says of those child issues, get just the ones that are Bug or User Story issue type and have a Status that is not in the "Done" Status Category.
and issueType in (Bug, "User Story") and statusCategory != Done
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill Sorry, one more favore. Could you please please let me know how the query would look like if I wanted to list all Done, Rejected Epics with not completed Bugs and User Stories? I'd greatly appreciate it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The query already does that with part 3 mentioned in my previous reply.
If that is not the result you are seeing, please show us your query and an example of an issue that is in the results that you don't want in your results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill The query I am using looks like this:
issueFunction in issuesInEpics("project = DEV AND status in (Done,Rejected)") and issueType in (Bug, "User Story") and status not in (Closed, "Not a Bug", Done, Rejected, Resolved)
As a result I get User Stories and Bugs, but no Epics:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, nuts!
I misread your post. I was giving you a query to get the child issues. So sorry about that!
You need the epicsOf function to get the Epics based on a filter of child stories.
issueFunction in epicsOf("project=<yourProject> and statusCategory!=Done and issuetype in (Bug, "User Story")") and status in (Done, Rejected)
1. This selects the child issues for which you want Epics.
("project=<yourProject> and statusCategory!=Done and issuetype in (Bug, "User Story")")
2. This gets the epics for those child issues
issueFunction in epicsOf
3. And this further filters the retrieved Epics by status
and status in (Done, Rejected)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.