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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,237
Community Members
 
Community Events
184
Community Groups

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

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.
Jun 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

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

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 

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