Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

2 votes
Answer accepted
Sam Harding Atlassian Team 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 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

321 views 3 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you