Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence of actions execution in automation?

Günther De la Motte
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!
June 9, 2023

Hi All,

I have created a rather complex automation to get some numbers from the children below an Epic.

I have a custom field which I want to populate in my Epic.

I have Stories and tasks assigned to the Epic.

I have Sub-Tasks in some stories, not all.

In my automation I want to get the custom value from the sub-tasks, based on specific components set at sub-task level. I update the custom value in my story when the criteria are correct.

Then I check the tasks and stories without sub-tasks and also based on specific components, I update the custom value in my story or task.

(the above process I repeat for different components and different custom values)

At the end of my rule I want to take the sum of all stories & tasks in order to update the custom values in the Epic.

This last step doesn't work. In order to find the root cause, I added a Log Action, in order to see if the different steps are correctly executed.

As you can see in the screen shots below, the action log Steps 1 - 5 are correctly executed in the sequence of my automation:

image.pngimage.png

As from step 6 the sequence is no longer correct, step 7 is firs then step 6 then step 8:

image.png

As last action log, you see the sum of the different custom fields based on a lookup issues. Which shows me incorrect values.

 

When we execute this last step with another automation rule which is only taking the sum of the custom values, we see that it is working fine:
image.png

So I think my last step is not working in my complex automation due to the fact the the sequence of my actions is mixed up.

Anyone who has an idea how to control this sequence?
Or who had experienced a similar issue?

Kind regards,

Günther

1 answer

1 accepted

0 votes
Answer accepted
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.
June 9, 2023

Hi @Günther De la Motte 

You do not show your actual rule for context (which can help for a question like this) and I hypothesize that you have one or more branches in the rule.  If that is the case, please consider...

Rules generally execute from beginning to end, in order of the steps, with a couple of exceptions:

  • The action to Send Web Request runs in parallel of the rule, unless you select the option to wait for the result before proceeding
  • Branches.  More specifically...
    • Branches which can only be on one-and-only-one thing can run inline, as if the branch did not exist.  Examples are branches on current issue, most recently created issue, and epic (parent)
    • All other branches are run asynchronously and in parallel, independently of the rest of the rule.  There is no guarantee that the steps/loops of the branch will finish until up to the end of rule execution.  Please look here for more information.

These are clearly by design, but force us rule-writers to alter our thinking about rule execution and parallelism.  Often solutions are to use one of these methods:

  1. Unroll your loops, and perform the steps in-line.  Rules have a limit of 65 components and so this is not always possible.
  2. Remove loops meant to accumulate results, and instead use Lookup Issues.  For your use case, you may also want to use smart value, list filtering on those subtasks where you wanted to selectively use them.
  3. Divide and conquer.  When you have rules impacting parent -> child -> grandchild issues (or linked issues), create separate rules for each level, and as the last step in a rule, do something which will trigger the next rule.  The code smell that this method could help is when one believes they need either multiple or nested branches.
  4. Use the REST API (and send web request) (or lookup tables) to gather the issues in the order you want, giving the ability of simulating multiple lookup issues results at once.

If none of these help, please post an image of your complete rule to provide context for the community to offer suggestions.  Thanks!

Kind regards,
Bill

Günther De la Motte
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!
June 13, 2023

Dear Bill,

As you correctly assumed, I indeed use multiple branches within my rule:

2023-06-13_14-34-40.png

So in my case I should trigger the first branch in rule 1, which will set all values of my Stories linked to the Epic, to zero.

And then create a 2nd rule which is triggered when all values of my story are zero, in order to calculate the value of my sub-tasks...

2023-06-13_14-44-48.png

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events