Job Scheduler: instead of calculating with linked Issues, using a JQL to get an array of Issues

Michael Reiff January 23, 2020

in the template  "Calculate Progress" an array of relevant Issues is created by analyzing the Link of the current Issue.

Instead of using the Link-Types I have to use a JQL. Will this be possible and can someone prepare me an example?
My example of the JQL in a few words: all Issues of Type Story and where I am Assignee, in the same Project as the current Issue).

 

Additonal Information:

This Groovy is running well, but it is a Groovy and not an Bean Shell:

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.bc.issue.search.SearchService 

import com.atlassian.jira.jql.parser.JqlQueryParser

import com.atlassian.jira.web.bean.PagerFilter

import com.atlassian.jira.issue.search.SearchQuery

def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)

def searchService = ComponentAccessor.getComponent(SearchService)

def jqlSearch = "project=HOINTAA AND issuetype=Story"

def query = jqlQueryParser.parseQuery(jqlSearch)

//note different order of parameters compared to searchprovider

def results = searchService .search(user,query, PagerFilter.getUnlimitedFilter())

results.getResults()

return results.getResults().issuekey

 

How to modify the Groovy that it runs as Scheduled Script with Bean Shell in WBS-Featrure Settings?

 

1 answer

0 votes
Michael Reiff January 23, 2020

Even this modified Script, did throw an error:

import com.atlassian.jira.component.ComponentAccessor;

import com.atlassian.jira.bc.issue.search.SearchService; 

import com.atlassian.jira.jql.parser.JqlQueryParser;

import com.atlassian.jira.web.bean.PagerFilter;

import com.atlassian.jira.issue.search.SearchQuery;

user = "reiffm" //ComponentAccessor.jiraAuthenticationContext.loggedInUser;

JqlQueryParser jqlQueryParser = ComponentAccessor.getComponent();

SearchService searchService = ComponentAccessor.getComponent();

jqlSearch = "project=HOINTAA AND issuetype=Story";

query = jqlQueryParser.parseQuery(jqlSearch);

//note different order of parameters compared to searchprovider;

def results = searchService .search(user,query, PagerFilter.getUnlimitedFilter());

results.getResults();

return results.getResults();

Suggest an answer

Log in or Sign up to answer