How to set a specific order of execution of automation rules using auto. rule with trig. IncWebhook?
Asked by Andrey Rudnev:

I have three custom fields, each of which is filled in automatically when creating an issue using automated rules with certain values. It is fundamentally important for me to set up a strict order of execution of these automated rules using Webhook. The order of the rules should be as follows: first, RULE 1 is executed, then RULE 2 is executed, and only after successful execution of RULE 2, RULE 3 is executed. According to my knowledge, I understand that each rule should have an action "Send web request" and another one should be created. an automated rule triggered by Incoming webhook. Can someone tell me how to implement your plan?


Answers:
author: Andrey Rudnev
body: I will be able to solve my problem like this:

Rule 1

![rule a.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/169088i740460DE28D92158/image-size/large?v=v2&px=999 "rule a.JPG")

Then Rule 2 has trigger "Incoming webhook"

![rule b.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/169089i44DE21FFF6BC8885/image-size/large?v=v2&px=999 "rule b.JPG")

Rule 3 also has the same trigger

![rule c.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/169090iFCE7FD9B2E8ED4AC/image-size/large?v=v2&px=999 "rule c.JPG")

In this way, I organized a strict order of execution of my rules.

comments: author: Sabrina M?senbacher
body: Hello Andrey.  
I have a similar use case to yours and wanted to ask how you built your automation rule in detail:

At the end of Rule A, you took the generated URL from Rule B via "Send web request" and selected HTTP method POST. But which option did you select for the Web request body field \[empty \| issue data (automation format), custom data, issue data (jira format)\]?  
Or did you fill in any other fields as part of the "Send web request" - if so, which ones?

At the beginning of rule B, you then used the "Incoming webhook" trigger with the JQL search option.  
Which JQL query did you store here and did you fill in any other fields / options as part of the "Incoming webhook"?

Many thanks for your help.

Kind regards  
Sabrina


author: Bill Sheboy
body: Hi [@Andrey Rudnev](/t5/user/viewprofilepage/user-id/4528317)

For automation for Jira, the only way I know to enforce the order of triggering for a set of rules is to:

1. create the conditions in the order you want rules to execute
2. and if you want one rule to trigger another, set the downstream rule's option to "Allow Rule Trigger"

For #1, that means creating conditions in your rule to make updates which lead to a trigger firing. For example, if Rule-A updates an issue's fields, Rule-B's trigger checks for the update to the field of interest.

Of note: for such a use case it may be helpful to use the Re-fetch action after the trigger in the downstream rules. This will reload the data and reduce the chance of timing issues where the issue data has not caught up with the prior changes.

Kind regards,  
Bill

comments: author: Allison Stewart
body: I have the same situation. I do have the "Allow rule trigger" checked on my second rule. But where do I indicate which rule it should follow? Can you only do this by webhooks?

If I want to set the webhook, how do I know or create the webhook?

I would guess that I need the URL for "running" the automation, not just the URL for the edit automation page.

I'm on Cloud version. Will I have access to this?


author: Bill Sheboy
body: Hi [@Allison Stewart](/t5/user/viewprofilepage/user-id/4680771)

That is not how the option "Allow Rule Trigger" works...When you have multiple rules and the actions of one rule could trigger another, you may enable Allow Rule Trigger in the "downstream" rules of the earlier one(s).

The use case of using webhook to chain/trigger rules is only needed when your rules do not create conditions which can be detected by other rules. That seems like an edge-case to me, and often this can be solved be re-considering your rule designs.

If you are having a specific problem with rule triggering, please create a new question. Otherwise only the people following this old thread will see what you are asking. With your new question, please include the following for context:

* what is not working as you expect
* an image the rule causing the problem
* and an image of the audit log details showing the rule execution

Kind regards,  
Bill


author: Allison Stewart
body: I actually combined the 2 rules so that it would run correctly. It's a huge rule, but it works. Thanks.


author: Bill Sheboy
body: Well done! That is often a better way to go, when possible, as it reduces some timing issues.

The caveat is any branches in a rule: branches which *could* run on more than one issue are run asynchronously and in parallel. And so if you need the results of processing earlier in the rule to roll-up some value, that is not possible in one rule with a multi-issue branch.


author: Dave Symonds
body: [@Allison Stewart](/t5/user/viewprofilepage/user-id/4503033) I got hit by Jira component limitations - did you get this issue?


Tags: cloud

custom-field