Hi there,
I need to collect all summaries of Epic's issues in one comment and do it by JMWE Event-based actions.
I created Event-based action "comment related issue".
I can find all issues with type Task or Story and Component "BA" in Epic by:
jqlSearch("project = ${issue.get("project")?.key} and component = BA and issueFunction in issuesInEpics('key=${issue.get('customfield_10008')}') and type in (Task, Story)", 20)
where
project = ${issue.get("project")?.key} is getting current project of current issue;
customfield_10008 is 'Epic Link' field and
issueFunction in issuesInEpics('key=${issue.get('customfield_10008')}') is query for all issues where Epic Link is the same as in triggered issue.
I get:
Collections$UnmodifiableRandomAccessList
[DocumentIssueImpl[issueKey=PROJ-362], DocumentIssueImpl[issueKey=PROJ-360], DocumentIssueImpl[issueKey=PROJ-359]]
But how can I collect all summaries from this 3 issues and put it into one comment?
Hi @Harry ,
the jqlSearch function returns a list of Issue objects. You can access fields of these issues in many different ways, such as iterating over the list, using the *. operator, using the join method, etc.
For example, to return a bullet list of the issue summaries with links to the issue, you can use something like this:
def issues = jqlSearch("project = ${issue.get("project")?.key} and component = BA and issueFunction in issuesInEpics('key=${issue.get('customfield_10008')}') and type in (Task, Story)", 20)
issues.collect{
"* [${it.summary}|${it.url}]\n"
}.join()
Of course, if you're using a Groovy Template value for the comment, you'll need to put this in a <% %> block:
Look at these issues:
<%
def issues = jqlSearch("project = ${issue.get("project")?.key} and component = BA and issueFunction in issuesInEpics('key=${issue.get('customfield_10008')}') and type in (Task, Story)", 20)
print issues.collect{
"* [${it.summary}|${it.url}]\n"
}.join()
%>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.