Iterate through JQL result of issues, extract certain fields, and send a formatted Slack message

Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2025

Hi all

I'm over my head with this ask, that I got last week. Quite specific:

- Every Friday run a JQL query to list up open "Blockers" (scheduled automation rule can do that)

- For each issue, extract the key, Assignee, and Summary

- Send a single Slack message to a shared channel with these 3 fields (1 line per issue) and also tag the Assignee in that line

I've messed around with {{lookupIssues}} but not found a way to format it. Let alone match the Atlassian user ID with Slack user ID...

The Slack message should look something like:

===

Outstanding blockers:

ABC-100 Jane Doe (Slack tagged) Improve the existing API
ABC-101 John Doe (Slack tagged) Finish the new brochure

===

Any ideas?

Takk,
KGM

3 answers

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 14, 2025

Hi @Kristján Geir Mathiesen 

There are two parts to this one: the Slack user ID and the issue field listing.

How many users do you have for Jira and Slack to map to one another? 

  1. When you have just a few, you could use a Lookup Table to map them, using the Jira user's account ID as the key and the Slack ID as the value.  Or, use a long chain of replace() functions.
  2. When you have many users, it may be better to use a separate process to add an entity property for each Jira user, and look them up.  This article describes the method to bulk add them: https://community.atlassian.com/t5/Automation-articles/Mention-someone-directly-in-Slack-via-Jira-Automation/ba-p/1528605

 

That second approach is better for the next step: listing the fields.  The reason is when iterating over the data in the Lookup Issues result, outside data is not visible.  And if the Slack ID is already present for the Assignee data, they can easily be mentioned.

I'm not using Slack a lot currently, so I recommend looking at the necessary formatting in their information.  Perhaps something like this:

{{#lookupIssues}}
* {{key}} - {{summary}} assigned to {{assignee.displayName}} <@{{assignee.properties.metadata.slack_id}}>
{{/}}

 

Kind regards,
Bill

Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2025

Takk, @Bill Sheboy ! Love it! I didn't know how to list them up with more than just the issue key.

I think we might only have a few users so I'll look into the Lookup Table

Thanks a million!
KGM

Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2025

Sorry, I am not able to access the "Value" in the table (and as you can see in the pictures, I've simplified the value and the Slack message to try to troubleshoot).

What am I doing wrong, @Bill Sheboy ?

SCR-20250114-qarg.png

SCR-20250114-qavf.png

SCR-20250114-qazr.png

Takk, KGM

Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2025

I can access the table with

{{nafn.entries}}

and print the results in the Slack message but somehow it doesn't work in the loop/iteration.

Takk again, KGM

0 votes
Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2025

Or you, brother @Darryl Lee ?

0 votes
Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2025

Hey @Bill Sheboy  Any ideas?

Takk, KGM

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events