Forums

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

Automation for Jira - How to call one rule from another?

Malka
Contributor
April 20, 2020

I have had to split one automation rule into two because the rule runs so fast that the two fields we want updated do not both get updated when the rule is in one. The first part of the rule executes and the mathematical calculation happens and the value is stored in the first field, but the second part, where we update the second field with a corresponding value based on the calculation is not getting done. 

So we are attempting to have the first part of the process placed in one rule and have that call a second rule. We have split the logic, checked that both rules can be called by other rules, they are both global rules and.... now what? I do not see anything under actions that says, "Call a rule."

4 answers

2 accepted

0 votes
Answer accepted
John Funk
Community Champion
April 20, 2020

Hi Malka,

What if you left it as one rule and had Automation do a Refresh of the issue prior to the update of the second field? It's a blue Action type called Re-fetch issue data. 

Malka
Contributor
April 20, 2020

John I wish I could also accept your answer as tossing in two of the Re-fetch issue back to back solved the problem of the race condition I was having. Since Jack did cover the split of the rule and was first I did select his answer. Thank you for chiming in though!! Very simple, explicit and easy to read answer from you. I appreciate it.

John Funk
Community Champion
April 20, 2020

Great - glad I could help!

0 votes
Answer accepted
Jack Brickey
Community Champion
April 20, 2020

You will need to ensure the first rule results in an event that can be used as a trigger in the second automation. I have not attempted but wonder if this doc tip might not help though. Worth a go I guess.

If this issue is affecting your rule, you can introduce a delay into your rule by adding a number of Re-fetch issue data actions

0 votes
Chris Buzon
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.
April 24, 2020

I'm using the refetch function for a couple of rules, however, it still seems to fail every so often. I've had to set up another job that detects when rule 1 has run but rule 2 has not (Based on JQL), then using that as a trigger to redo the missing calculation.


Malka
Contributor
April 24, 2020

Another automation rule? If so, can you provide the jql as example?

Chris Buzon
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.
April 24, 2020

Sure - this might be unique to how we're doing this work.

Setup - during workflow transitions, timestamps are recorded in 3 custom fields using post functions. We have plugins that make this easy, but it's possible to do this in lots of different ways.

Rule 1 calculates lead time by diff'ing our "To Do" timestamp and our "done" timestamps.

Rule 2 calculates cycle time by diff'ing our "In Progress" timestamp and our "done" timestamps.

Both rule 1 and 2 run on a list of projects, and are triggered on transition into "done" from a list of other statuses.  

This is where things sometimes go weird. Both rule 1 and rule 2 have re-fetch values as an attempt to delay them. Cycle times has never failed. Lead time fails occasionally, even though they're clones with slight modifications.

Rule 3, an upkeep rule (I just call it that) detects missing data by:
status = "DONE" AND "Lead Time" is EMPTY AND "Cycle Time" is not EMPTY.   

That rule runs once a day, and appears to fix 1-2 bugs a day.  By checking to see if Cycle time is filled (which never fails for some reason), I can tell if lead time should have as well.


I admit it's a bit convoluted, but appears to do the trick.

Malka
Contributor
April 27, 2020

Thank you. I may do that in a different situation. I need something that will return the data in real time for now. the re-fetch seems to be working but I like your daily "job" idea for things that aren't time sensitive.

0 votes
Malka
Contributor
April 20, 2020

My rule is triggered by Manual Run and I need them run in a specific order, if that helps answer the question at all

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events