How can I use IF-statement on lookupIssues to post a header for the list (automation rule)

Lars Gjestang February 23, 2024

Hi,

 

I am using automation rules for sending weekly statuses about all projects that are ongoing. It is currently configured to post 3 issue lists to Slack:
1. This week's summary
2. Resolved last 7 days
3. No updates last week (no issues updated last 7 days)

 

I do already have this working by having one JQL action per Slack message. However, this is quite messy, time consuming and hard to maintain with many projects. Example of how it works today:
image.png

So instead of creating 3 JQL actions I was thinking to have 1 JQL and then rather filter out the list for each Slack message I configure. All of this is works correct if the filtered list actually has any values. The example below is how I have now changed the JQL to be filter on the EPIC and then use IF-statement within the {{lookupIssues}}

image.png

Problem is however, if the list is empty I do not want to post either the header of the list nor the issues. Currently I can only make it either always post the header (if list is empty or not) or if I try to move it to the red line in picture above it will post the header for each listed ticket.

How can I make the text "This week's summary" only to show once if the IF-statements within each {{lookupIssues}} returns issues?

2 answers

2 accepted

1 vote
Answer accepted
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.
February 23, 2024

Hi @Lars Gjestang 

One way to do that is to pre-filter the results from the lookup issues action, storing them in created variables (or a single lookup table); then the send message may use if conditions on the variable to determine if they should be included (or not).

Kind regards,
Bill

1 vote
Answer accepted
Marc Koppelaar
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.
February 23, 2024

Hi @Lars Gjestang 

You can't in the way you want to achieve this.

You would need an if/else in your branch.

Are there issues found yes or no, if yes a slack message goes out, if no message.

In the setup you have created a slack message is sent anyway values or not. You can't define if the slack message is sent in the sent slack message action.

In the send slack message action you define your message, not if it will be sent or not.

That were you need conditions.

Lars Gjestang February 28, 2024

I don't mind if the action is triggered either way - as the message will be just empty if there are no issues to list. As the message-action does actually support using conditions to define which issues I want to list or not, you are correct that I can't achieve sending a single message based on conditions. 

So I ended up continue with what I already am using in my current "template", which is 3 different actions for JQL lookup. 
For anyone wondering, here is the start of it (showing 2 of the lookup-actions)
image.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events