Forum Discussion

sanusoman321's avatar
12 years ago

Grrovy script - help

Hi All,

Don't know is this the right place to ask my query! Also I feel you guys are familiar with JIRA tool. I'm trying to write a groovy script to auto populate number of issues on a JIRA issue filter (just count) to a custom field as part of workflow transition.

Below my sample script,

String jqlSearch = "filter= \"" + demo + "\"";
SearchService searchService = ComponentAccessor.getComponentOfType(SearchService .class);
ParseResult parseResult = searchService.parseQuery(authenticationContext.get LoggedInUser(), jqlSearch);
int totalIssues = 0;
if (parseResult.isValid()) {
try {
SearchResults results = searchService.search(authenticationContext.getLogg edInUser(), parseResult.getQuery(), PagerFilter
.getUnlimitedFilter());
final List issues = results.getIssues();
totalIssues = issues.size();
//add code here to update custom field
MeD = cfm.getCustomFieldObjects(issue).find {it.name == 'IssueNumber'};
setCustomFieldValue(MeD, totalIssues);
} catch (SearchException e) {
e.printStackTrace();
}
}
I'm not getting excepted result with this script and I'm very much new to groovy world, so can't figure out the issue. Can anybody from here help me to sort it out.. please?

Many thanks in advance.

thanks,
Sanu P Soman

1 Reply

  • SiKing's avatar
    SiKing
    Community Expert
    sanusoman321 wrote:
    Don't know is this the right place to ask my query! ... I'm trying to write a groovy script to auto populate number of issues on a JIRA issue filter ...

    This is definitely not the right the place! You might try here: http://support.atlassian.com/