Workarounds for Scheduled Notifications / Automation Batch Processing?

Evan Nixon
Contributor
November 23, 2021

Hello!

I'm currently attempting to create a notification which sends a direct Slack message/notification via a Webhook, based on certain conditions. The rule runs every weekday at 9am and 4pm, and follows this logic :

 

JQL : Are there tasks where the custom field "Waiting on Reply" is NOT EMPTY and hasn't been updated in more than 12 Hours??

     IF TRUE : Continue automation.

     IF FALSE : End automation.

BRANCH IF ELSE : Do any of the LookupResults "Waiting on Reply" field contain DisplayName "User 1"?

     IF TRUE : Send web request then continue to next BRANCH IF ELSE

     IF FALSE : Continue to next  BRANCH IF ELSE

BRANCH IF ELSE : Do any of the LookupResults "Waiting on Reply" field contain DisplayName "User 2"?

     IF TRUE : Send web request then continue to next BRANCH IF ELSE

     IF FALSE : Continue to next  BRANCH IF ELSE

(continues on repeating above BRANCH IF ELSE)

 

Everything is almost working as intended, however when the request is run it sends as many messages as match the JQL Search, when I really only want it to send one.

I did successfully get a user property set for four users using the instructions here and have the smart value {{issue.customfield_10632.get(0).properties.slack}} work as intended, however this didn't work out as I wanted due to {{lookupIssues}} not supporting custom fields.

I've done four separate branches of IF ELSE with the usernames manually input, which works for me considering there are only 4 users this needs to target (though a recursive option that changes the ".get("X")" each run until every user in the JQL lookup has received one notification would be nice).

Here's the automation rule as is. I did try and take the advice of the venerable @Bill Sheboy in this thread, but didn't have any luck there either.

 

Screenshot 2021-11-23 121555.png

 

Which outputs this :

Screenshot 2021-11-23 115533.png

 

Any ideas on how I can get this to not run 4 times from 4 results being found in the JQL? Navibot should be annoying, but not quite this annoying.  

1 answer

1 vote
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.
November 23, 2021

Hi @Evan Nixon 

You do not show your trigger's details, and I suspect that you have JQL in the trigger.  Correct?

If so, that is why this is running for each issue found by the trigger.  The way to address that is to remove the JQL from the trigger and just run it on the time interval.  Then use a condition to check for issue matches on the JQL to halt/continue processing.

Kind regards,
Bill

Evan Nixon
Contributor
November 23, 2021

Hi @Bill Sheboy 

Thanks for your help on this, much appreciated as always. 

I actually don't have any JQL set in the Scheduled Trigger. I did initially try it that way, which gave the same result : way too many notifications. The reason I have the JQL separated out was actually because of your comment here on a thread about working around Jira Cloud not having a "Process all issues produced by this trigger in bulk" button - unfortunately that isn't seeming to work in this context. 
Screenshot 2021-11-23 172902.png

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.
November 23, 2021

Got it, and just to be clear: you are using Jira Cloud, correct?

If so, then try this:

  • Take the JQL for your branch and instead use Lookup Issues with it
  • Remove the branch
  • Follow that with a if/else, and
    • Advanced compare condition on {{lookupIssues.size|0}} greater than 0
    • Action to send the webrequest
    • Action to write to the audit log
  • Repeat for your other branch...

That will allow you to execute the the if/else contents one-and-only-one time, yet have access to the specific issues using list functions on the {{llookupIssues}} result.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events