Jira Cloud Automation: Scheduled JQL Trigger Slack When Issues Are Found

Adam Dulberg June 19, 2020

I'd like to create a project rule that runs on a specific interval defined by Cron. It should run JQL. I then have an action to 'LookupIssues' to reference those issues in the Slack post. However, it should not run if 0 issues are found in the JQL. My rule works (always even if 0 issues found), and currently looks like this:

When: Scheduled -> Then: Lookup issues -> And: Send Slack message

I tried to use if/else blocks but getting errors when trying to publish. The message is saying I must check the box "Run a JQL search and execute actions for each issue in the query" within the advanced (CRON expression) tab in Scheduled trigger. There seems to be a certain combination where CRON is used that the box is not checked.

The reason I do not want that boxed checked is because if multiple issues are found in the JQL, my slack post will post the same thing for every ticket.

 

Ultimate goal: Have 1 slack post that includes any number of lookup values if 1 or more issues is found in JQL. If no JQL values are found, do not run the rule. The rule runs on a schedule defined by CRON.

Anyone currently doing this and have a solution? Thanks.

1 answer

1 accepted

3 votes
Answer accepted
Sam Harding
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 22, 2020

Hi Adam,

This should be possible using the components you are currently using. With your configuration, are you using 'Run a JQL search ....' on the CRON, as well as the lookup issues action? To achieve what you are wanting it should be able to use that component chain without having to specify the JQL check box in the CRON. I believe this combination should achieve what you are wanting:

1. Scheduled Trigger: 'Advanced CRON' selected, 'Run JQL....' not selected.
2. Lookup Issues Action: Specify the JQL criteria
3. Advanced Compare Condition: For the condition type, select 'Advanced Compare Condition'. Here, input the values {{lookupIssues.size}} greater than 0
4. Send Slack Message: Send your message, the lookupIssues variable by this point should always be a non 0 list of issues

Is this the same set up as what you have been attempting? If not, can you give that a try and see if that is successful?

Thanks

Adam Dulberg June 26, 2020

Your directions worked perfectly Sam. The issue was missing step 3. Once I added that everything was as intended.

Thanks.

Like Sam Harding likes this
Nathan Johnson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 15, 2020

Hi Sam,

This answer was helpful for me as well, I essentially had the exact same problem that Adam had.

Looking at the documentation here: https://support.atlassian.com/jira-software-cloud/docs/automation-actions/#Automationactions-Lookupissues

I assumed that the fields listed were the limit, and it mentions that "smart values" were not available to be used with {{lookupIssues}}. 

I haven't searched the docs extensively, but is there a resource that would have allowed me to figure out on my own that the .size attribute could be used on {{lookupIssues}}?

Doing a little bit of searching, it seems like .size is a "smart value" associated with lists, can I treat {{lookupIssues}} as a list in other ways?

 

Thanks,

Nathan 

Vlatko Bojkovski April 15, 2022

I came here to comment that it helped me as well!

 

Good job Sam.

 

KR,

 

Vlatko

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events