Forums

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

Automation rule runing twice with change of value

Anna
Contributor
October 20, 2023

Hi, 

 

I have an automation that runs if a parent link is added, changed, or removed from an issue.

My main problem : 

When I create an issue from an EPIC, it seems, that it both creates and edits the issue. so.. the rule runs twice.

 

I created separated automations for creating and editing issues, and it confirmed the behaviour.. 

the rune is rules once for creation and once for edition when creating an issue directly from an Epic.

 

Also... when I create an issue without linking it from scratch to an Epic, I get an error.

 

Some help on that would be much appreciated.

 

 

parent link.pnglabel from parent.png

1 answer

1 accepted

1 vote
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.
October 20, 2023

Hi @Anna 

I have seen this symptom noted in a few other posts: issue linking does not occur at the time of issue create, and instead happens as a separate edit.  This happens for manual issue creation and by automation rules.

Which is curious as the REST API does support adding one link, but not several.  And so that is probably why this design was used.  There is an open defect / suggestion to allow adding multiple links during issue create: https://jira.atlassian.com/browse/JRACLOUD-81845

So on to work-arounds...

One way to solve this is to remove the Create Issue selection from the trigger.  For your scenario you want to perform the same action for create and edit, and so eliminating the create selection should solve the double rule execution.

 

However, I notice some things in your rule and wonder:

  • What do you want to happen to the labels if the parent is removed or change for an issue?  For example, do you want to remove the prior parent's labels?
  • What do you want to happen if the labels in the parent change after they have been previously copied?

Essentially, are you trying to sync the labels from the parent down to children, or only perform the one-time set of values?

Kind regards,
Bill

Anna
Contributor
October 23, 2023

Hi @Bill Sheboy 

Thank you for your reply. 

Indeed, deactivating the "creation" trigger helps ! I am ashamed I didn't think about it 😅

 

To answer your last questions : 

Yes, I am trying to sync the labels from the parent down to children. But as the parent might never change.. it is ok to do it this way. But if you have a better way, I would be more than happy to learn it.

 

Kind regards,

Anna

Like Bill Sheboy likes this
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.
October 23, 2023

I am glad to learn that helped...and apologies in advance for my long, follow-up answer :^)

Sync of fields is not something built-into Jira.  And so it helps to consider the different scenarios, and which ones you want to address...

  • If this is a one-time sync, and the different issues "go their own way" later, there is nothing else to do
  • But if sync-all-the-time is desired, think about both the likelihood of change and complexity to do this
    • Your rule handles new, child issue create well
    • For edit, if the parent changes, the rule becomes more elaborate to "remove" labels from the previous parent.  That could be added to this rule using the Lookup Issues action to get the old parent's labels and remove them.
    • Two additional rules to tighten up the sync are:
      • Tampering: triggered on manual changes to the Labels of a child issue, force labels back to sync with the parent, and perhaps notify the person performing the edit about the change with a mention in a comment
      • Top-down update: triggered on manual changes to the Labels of the epic, re-apply the values back to all of the child issues
Like Anna likes this
Anna
Contributor
October 23, 2023

Eheh I hoped you had a magic way of doing it. That's exactly what I did in another project. 

 

Thank you for taking the time to answer :) 

Like Bill Sheboy likes this

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