Forums

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

Iam requesting aquery be created within Jira(using ScriptRunner,etc.)that returns a list of issues

mummareddy supriya
Contributor
April 11, 2024

For the Fix Version/s's __ start date +1 week the Planned Release field was populated but the same Planned Release was removed prior to the Fix Version/s's end date. This query is intended to capture accidental change in the Planned Release field after release scope is committed without requesting changes to the field within Jira.  IF PlannedRelease CONTAINS "input"  timespan (FixVersion.StartDate to + 1 week) AND  PlannedRelease NOT CONTAINS "input"  timespan(FixVersion.StartDate + 1 week to FixVersion.EndDate) 

where "input" is a specific releaseWithin EPP, we have distinct usages for the Planned Release and Fix Version/s fields. The aggregate of all issues with a specific Planned Release represent a baseline plan. We use this data to compute the PlannedToDone% for epics (features, solution, software components) and task-level (stories, tasks, change requests, and defects) for inspection on release planning effectiveness. 

 

Planned Release - indicates the release an issue is planned for. This may hold multiple values if the issue was not delivered in the first planned release. Values are intended to be appended to, not removed. 

Fix Version/s - indicates the release an issue is delivered in. This is only set to a single value as an issue can only be closed within a single release. 

1 answer

0 votes
Matt Parks
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.
April 11, 2024

Are you asking for assistance in writing the JQL that returns the issues that you're looking for, or are you asking for assistance in writing the code in Scriptrunner that returns a list of issues based on the query that you provide in the script?

mummareddy supriya
Contributor
April 12, 2024

yes,i'm asking for assistance in writing code in scriptrunner hat returns a list of issues based on the query that you provide in the script

Matt Parks
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.
April 12, 2024

I don't know if the groovy is the same in Cloud as Data Center, but here's what I use. Note that I use this as a function inside my script, since it's repeatable code that I include in a lot of my scripts. I think I've included all of the necessary imports

In the below example, I bring in the epicKey into the function because it's a dynamic value that I use to populate the query that I'm returning. This script returns all of the issues under a particular epic (not defined in this code block)

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.jql.parser.JqlQueryParser
import groovy.transform.Field
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.web.bean.PagerFilter
@field SearchService searchService = ComponentAccessor.getComponent(SearchService.class)
 
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issues = getTemplateEpicIssues(it, user)

Collection<Issue> getTemplateEpicIssues(String epicKey, ApplicationUser user)
{
    def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
    def childrenQuery = jqlQueryParser.parseQuery(""" issuefunction in issuesInEpics("key = ${epicKey}") ORDER BY Created ASC""")
    def children = searchService.search(user, childrenQuery, PagerFilter.getUnlimitedFilter())
    return children.getResults()

}
 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events