If I label an Epic can I automate that label to go to all the tasks related to that epic?

sofia.pedro July 21, 2020

Before installing Automation for Jira, I want to know if it is possible to automate the labels that an epic has to all the tasks related to it. 

 

For example, I have a label on an epic "testing". Can I automatically make sure any task linked to this epic will also have the "testing" label?

 

 

1 answer

1 accepted

5 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.
July 21, 2020

Hi @sofia.pedro  -- Welcome to the Atlassian Community!

Yes, you can copy the label to the tasks associated to the epic.  And, the automation rules feature is already included with JIRA Cloud, so there is no need to install or add it.

As an example, your rule would be:

  • Trigger: field value change for Labels
  • Condition: issue type equals Epic
  • Branch: for all the stories or issues in the Epic
    • Action: edit the Labels field, copying it from the Epic

To get started and learn more about the automation, please review this documentation:

https://support.atlassian.com/jira-software-cloud/docs/automate-your-jira-cloud-processes-and-workflows/

 

Best regards,

Bill

sofia.pedro July 23, 2020

Hi Bill,

Thanks for this response I was to automate copying down labels from Epics to all the stories or issues in the Epic!

However, I am having issues with two different scenarios and was wondering if you could help me.

  1. If I add a new issue under an epic it does not copy down the labels from the epic. It only copies the labels in already existing issues or stories
  2. If a label is removed from an epic it does not remove if from the issues within the epic. In other words, nothing changes in the issue's labels field if the Epic label is removed.

Best,

Sofia

Like # people like this
sofia.pedro July 23, 2020

Hi @Bill Sheboy ,

Thank you for your response! I was able to copy down the labels from epics to all stories or issues in the epic that are already existing.

However, I have problems with two different scenarios that I was hoping I could get your help with. 

  1. how do I get the Labels to copy from the Epic when the issue is created or the issue is associated with a new epic? Right now when a new issue is created within an epic it does not automatically copy down the epic's labels, only with existing issues.
  2. When a label is removed from an epic, how do I also remove it from all issues within the epic without overriding the other labels that the issue contains? In other words, as of now when a label is removed from an epic nothing happens with the issue's labels field.

Thanks again for your help.

Best,

Sofia

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.
July 23, 2020

Hi @sofia.pedro 

Sorry for the long answer, as I want to try to answer all of your questions...

At this time, you cannot iterate over a smart value field list, like Labels, to process the values separately in the branch.  That feature is in the backlog here:

https://codebarrel.atlassian.net/browse/AUT-546

Let's look at your scenarios to see what you can and cannot do at this time:

  • When an issue is created... You could create a rule
    • Trigger: issue create
    • Condition: Epic Link is not empty
    • Action: copy Labels from epic
  • When the epic changes for an issue... You could create a rule
    • Trigger: field change to Epic Link
    • Condition Epic Link is not empty
    • Action: copy Labels from epic
  • When a label is removed from an epic... I believe the rule I described will handle that case.  It did in my testing.
    • Trigger: field change to Labels
    • Condition: issue type is Epic
    • Branch: for stories and issues in Epic
      • Action: copy labels from Epic (triggering issue)
  • When an epic's labels change, do not wipe out unrelated child issue labels...
    • This one cannot be handled until AUT-546 is implemented
    • A work around would be to consider what you are using Labels to represent, and decide if the Label values added for the children could be represented in another way, such as with Components or a Custom Field.
    • A different work around would be if you *know* possible values for children labels, use an If/Else structure to test for them, copy the Epic Labels, and then re-add the value.  If you do not know the possible Labels, this will not help.

 

Best regards,

Bill

Like # people like this
sofia.pedro July 27, 2020

Hi  @Bill Sheboy ,

Thanks for your detailed explanation,

In regards to 1 & 2, it is impossible because choosing Epic Link is not appearing for us. We also want to be able to NOT copy certain labels as part of these scenarios. 

image.png

As for 3 & 4, we are adding to the existing values rather than replacing the label.

Best,

Sofia

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.
July 27, 2020

Hi @sofia.pedro 

I apologize for my error: it appears that it is not yet possible to trigger a rule based upon an Epic Link change.  Here is the ticket for that issue:

 https://codebarrel.atlassian.net/browse/AUT-1264

 

Regarding replacing existing labels, with the edit action you can select the ... to the right of the field and select Add/Remove, and select the Epic as the source to add from.

 

To back up you your original question, I wonder what information you are storing in Labels and if there is another way to solve the problem.  You noted "testing" but that seems more like a status.  What can you describe about the problem you are trying to solve?

Like kai likes this
Davis Moes October 29, 2021

I'm having a similar issue with this where the following logic does not work for sub-tasks:

  • Branch: for stories and issues in Epic
    • Action: copy labels from Epic (triggering issue)

It will work just fine for stories and tasks, but not sub-tasks. Is there a work-around for 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 29, 2021

Hi @Davis Moes 

That branch you note would not find the sub-tasks.  You could either:

  • create another rule, triggered on label changes to the stories, to copy down to their sub-tasks
  • in the original rule, extract all of the keys of stories in the epic into a created variable list, and then create another branch on JQL to walk the sub-tasks for updates:
    • project = YourProjectName AND issueType = subtask and parent IN (YourListOfStories)

Kind regards,
Bill

Like Davis Moes likes this
Davis Moes October 29, 2021

So I created two rules, first one is for updating the story, second is for updating the subtask. For some reason, the second rule (subtask rule) does not update the "Labels" field after the story or task's "Labels" field updates. All actions are updated based on "Copy from Parent Issue"

2021-10-29 14_00_20-Project automation - Tommy Projects and 28 more pages - Work - Microsoft​ Edge.png

 

2021-10-29 14_07_23-Project automation - Tommy Projects and 28 more pages - Work - Microsoft​ Edge.png

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 29, 2021

My apologies as I left out a key piece!

When you want one rule to cause triggering another, in the second rule, go to the Details and enable the option Allow Rule Trigger.  Otherwise the rule engine detects this as an error and will not fire.

Like Davis Moes likes this
Davis Moes October 29, 2021

That worked - thank you!!

Like Bill Sheboy likes this
Mehgan Hawk November 3, 2021

Hello! I'm trying to get a label added to an epic to then add to the child stories AND remove a label from stories if removed from the epic. I'm able to get the label to copy from the epic to the child stories but cannot get the label to remove.  Is this functionality now available or is there another rule I need to implement?

 label automation.PNGdetailed rules.PNG

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.
November 4, 2021

Hi @Mehgan Hawk -- Welcome to the Atlassian Community!

First thing: to get more people looking at your questions, please consider creating a new one and adding a link to related ones.  Otherwise, often only the people already watching will see it.

For your automation rule, are you trying to keep the epic and child issues in synch on the Labels field, or could the children have more labels than are in the parent epic?

Kind regards,
Bill

Mehgan Hawk November 4, 2021

Hey Bill! 

Thanks for the tip, I'll do that in the future.  

As for this scenario...I'm trying to do a few things on on this topic.

1. have an epic with child stories, add a label on the epic and have the label appear in the stories

2. have an epic with child stories, remove the label from the epic which should remove the label from the stories.

3. have an epic with child stories, create a label on a story, add a label to the epic and see both the new epic label and the existing story label both on the story.  

4. have an epic with child stories, create a label on a story, add a label to the epic and see both the new epic label and the existing story label both on the story.  then remove the epic label and it should remove that label from the story but retain the story label.  

After submitting my question yesterday, I've been able to accomplish 1 and 2 following the rules you've shared above BUT cannot get that rule to allow for 3 and 4. 

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.
November 4, 2021

Hi, Mehgan!

Your scenario *can* work with 2-3 rules, and it has some risks to handle: such as an endless loop (runaway) in rule execution.  The key is to have a stopping or "breaking" condition to prevent a problem.

You do not mention one thing: if the label changes in the Story, and cascades up to the Epic, do you expect that label change to cascade to the sibling stories also?  Let's assume that is what you wanted.

Rule 1 would be checking for Epic changes and Rule 2 would be checking for Story changes.  And, *neither* of these rules should have the option "Allow Rule Trigger" enabled in the details section.

Your rule was very close to what you need for Rule 1!

Here is an example for Rule 1, triggered on Epic changes, and cascading to the children.  The idea is to use the changelog and delete the old labels before adding the new ones.  This will require a re-fetch action, which slows down the rule quite a bit.

  • trigger: value changes for Epic (from an edit operation)
  • user condition: Initiator is not Automation for Jira
  • issue fields condition: issue type equals Epic
  • branch: for stories (or other issues in epic)
    • action: edit labels to REMOVE the old values using the changelog value
      • {{#changelog.labels}}{{fromString.split(" ")}}{{/}}
    • action: re-fetch to reload the changed issue
    • action: edit labels to Copy Labels from Trigger Issue

 

Rule 2 (Story up to Epic) is similar.  I assumed you want the siblings in synch also.

  • trigger: value changes for Story (from an edit operation)
  • user condition: Initiator is not Automation for Jira
  • issue fields condition: issue type equals Story 
  • related issue condition: Epic parent exists
  • branch: for Epic parent
    • action: edit labels to REMOVE the old values using the changelog value
      • {{#changelog.labels}}{{fromString.split(" ")}}{{/}}
    • action: re-fetch to reload the changed issue
    • action: edit labels to Copy Labels from Trigger Issue
  • branch: on JQL to find siblings with:  project = myProject AND "Epic Link" = {{triggerIssue.Epic Link}}
    • action: edit labels to REMOVE the old values using the changelog value
      • {{#changelog.labels}}{{fromString.split(" ")}}{{/}}
    • action: re-fetch to reload the changed issue
    • action: edit labels to Copy Labels from Trigger Issue

 

There is possibly a Rule 3: cloned from Rule 2, but using a trigger of Issue Created when stories are added to the epic later.

Suggest an answer

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

Atlassian Community Events