JQL query for Send Slack message (automation in Jira)

George Davitaya May 28, 2024

Hi, their! 

I am newbie in Automatisation Jira 

I have a issue, I need to create a request for a JQL query for automation in Jira
If there are tasks for approval, then send a message in Slack with a summary of tasks, if there are no tasks for approval, send a message “no tasks” 

 

but when using the if function, I receive a message for each task, I think that the issue is in the request itself, how can I make the request correctly?4.png5.png

1 answer

1 accepted

0 votes
Answer accepted
Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2024

Hi @George Davitaya and welcome to the Community!

{{lookupissues}} as you are using it is a smart value, it is not a JQL filter. In the use case, as you describe it, you should not add a JQL filter to your rule trigger, but instead run a Lookup Issues action first, with the appropriate filter to retrieve the issues you need. That may be something like this

status = "Waiting for Approval"

After that, you can use the {{lookupIssues}} smart value to refer to those issues and use it in conditions and further actions. The overall framework of your automation rule would then look like this:

Screenshot 2024-05-28 at 12.48.21.png

I used {{lookupIssues.size}} to count the number of issues returned by the filter. If there are 0, you can send a message that there is nothing to see here (or do nothing at all), and use the else part to send the desired message.

I used the log action because I don't have a Slack integration in my test instance, but I suppose you can see where your Slack messages should be ...

Hope this helps!

George Davitaya May 28, 2024

Hello! @Walter Buggenhout 

Unfortunately this still doesn't work for me( 

Are you sure that status = "Waiting for Approval" is the right request? I still receive a message for every task in Slack 

And if there is no task in the status "Waiting for Approval", I don't receive notifications(10.png9.png8.png7.png

Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2024

Hi @George Davitaya,

No, of course I am not sure if that is the correct JQL 😅 - I am not familiar with how your Jira configuration has been set up. It should be whatever it needs to be to pull a list of issues that need approval according to how that has been set up for you.

Since I notice that you tagged JSM in your question, it is possible that the below might work:

approval = pending()

That is the way you can search for the issues marked for approval following JSM's default behaviour.

But before applying it to your rule, go to the issue navigator in Jira first (via Filters > View all issues) and try out the provided query option first to make sure they return the right results. Then apply the correct JQL to your automation rule.

And again: uncheck the box "run a JQL search ..." from your rule trigger and replace it with the lookup issues action in my screenshot. As it literally says in the screenshot, your current setup "executes the action for every issue in the query"

Like George Davitaya likes this
George Davitaya May 28, 2024

It worked Thanks for your help!

 

Suggest an answer

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

Atlassian Community Events