Hello community.
Need a little bit of help with parsing groovy.
Putting together auto-answer script for one of my customer. The goal is, to return a comment with number of incidents AND urls for accessing them from Customer Portal URL for matching JQL. I did all of the scripting, I can find the issues and return number of results. What I am unable to find out is the way, how to process and return the list of URLs for results. (could be more tickets).
Right now I am ending with variable of:
Your script ran successfully against issue FOO-0001
Collections$UnmodifiableRandomAccessList
[DocumentIssueImpl[issueKey=FOO-0001]]
What I am looking for, is to iterate over the results and get list URLs.
Thanks in advance :-)
Note to future myself:
It is better and easier to iterate in this way:
def sb_url = []
String query_sb = 'JQL' // edit this query to suit
def query_sb_parsed = jqlQueryParser.parseQuery(query_sb)
def search_sb = searchService.search(user, query_sb_parsed, PagerFilter.getUnlimitedFilter())
def search_sb_total = ("total: ${search_sb.total}")
SearchService.ParseResult parseResult_sb = searchService.parseQuery(user, query_sb)
if (parseResult_sb.isValid()) {
def searchResult = searchService.search(user, parseResult_sb.getQuery(), PagerFilter.getUnlimitedFilter())
def issues = searchResult.results.collect {issueManager.getIssueObject(it.id)}
for (item in issues)
{
issue_string = issues.first().toString()
issue_url = baseurl + issue_string
sb_url.add(issue_url)
}
}
return sb_url
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.