Automation rule triggering twice

Matt Parks
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 2, 2024

I had seen multiple questions about users who had their Automation rule trigger twice and it was happening to me as well. I was able to figure out why it was happening in my case, so I thought I would share, in case it helped anybody else.

 

The rule was triggering when a transition was executed. In my case, the problem was that, as part of that workflow transition, I was also generating an additional event (besides the Generic Event) as a post function that was triggering a Scriptrunner listener.

As part of that listener, the issue was being updated and, as part of the update, an additional event was triggered. It appears that this additional event, because it was triggered from a post-function on the transition, caused the Automation rule to trigger a second time.

In my case, replacing the Generic Event post-function with the event that triggers the script listener and then removing the post-function that triggered that same event resolved the problem.

If it matters, I am currently running Jira 9.12.4.

2 answers

1 accepted

0 votes
Answer accepted
Brant Schroeder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 2, 2024

@Matt Parks Thanks for sharing this to help others.  If you can mark this as accepted it will help others find your answer here:

Reason for automation rule triggering twice:

The rule was triggering when a transition was executed. In my case, the problem was that, as part of that workflow transition, I was also generating an additional event (besides the Generic Event) as a post function that was triggering a Scriptrunner listener.

As part of that listener, the issue was being updated and, as part of the update, an additional event was triggered. It appears that this additional event, because it was triggered from a post-function on the transition, caused the Automation rule to trigger a second time.

In my case, replacing the Generic Event post-function with the event that triggers the script listener and then removing the post-function that triggered that same event resolved the problem.

0 votes
Aisha M
Contributor
August 15, 2024

Hi @Matt Parks  @Brant Schroeder , I have a similar problem, but it doesn't happen all the time, but only at certain times. I have the below automation provided by Atlassian to clear the Parent Link when issue type is changed - 

https://confluence.atlassian.com/automationkb/automation-for-jira-how-to-clear-the-parent-link-field-when-an-issue-is-moved-to-a-new-type-1206795140.html

At times, when I look at the issue history, the parent link is cleared twice from the issue. From your experience, any thoughts on why at certain instances the automation is getting triggered twice ?

 

Matt Parks
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.
August 15, 2024

It sounds like the automation rule is triggering multiple times. When you look at the audit log for the rule, can you tell when it's triggering? That might give you a clue as to what is going on.

Aisha M
Contributor
August 15, 2024

@Matt Parks I do see multiple logs for same issue keys. The automation gets triggered when the field value  (issue type) is changed and the parent link field is NOT empty

So, maybe out of 25 issues i have tested, two issues have field value cleared entry in their history twice. 

Matt Parks
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.
August 15, 2024

I've heard that sometimes an issue update can trigger very quickly to the point that the DB/index isn't fully updated with the changes, so it might be trying to trigger again. There is a 'Re-fetch issue data' action that you could put immediately before the action to clear out the parent link field, which might resolve the problem.

I'm honestly not sure if this will prevent the second update, but it can't really hurt.

Aisha M
Contributor
August 16, 2024

I tried adding the 'Re-fetch issue data' , but no change. But I have observed a pattern, the double entries in the issue history happens only when the issue type change happens from Epic to Portfolio Epic. For all the other issue type changes, its clearing just once.

Our hierarchy is Portfolio Epic > Program Epic > Epic > Story 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
This widget could not be displayed.
TAGS
AUG Leaders

Atlassian Community Events