Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Collect all Summaries from JQL request by Groovy

Edited

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:

Result type:
Collections$UnmodifiableRandomAccessList
Result value:
[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?

1 answer

1 vote
David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 30, 2022

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()
%>

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events