Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,294,689
Community Members
 
Community Events
165
Community Groups

How to create an Automation to copy Labels from Epics to Story/Task (Upon creation)?

Our team has adopted a new organizational method, via specified labels on all of our Issue Types. Unfortunately, I have run into a problem where I am manually applying all of the labels to the Stories/Tasks within my Epic. 

My initial goal was to proactively Label the Epic with the Team and Project Code, and have any issues created under the Epic automatically take on the labels of the Epic. 

I have been able to create an automation to make sub-tasks copy the labels of the Parent Issue, however, when I apply the same logic and use the Action: "copy from epic", the audit log informs me that it could not find the Epic to pull the information from.

Is there something I should be changing below to get this automation to work? 

 

Jira Automation.png

2 answers

1 accepted

4 votes
Answer accepted

Hi @Mizael Ponce -- Welcome to the Atlassian Community!

Your want your rule to trigger when a child issue (e.g. story) is created...and it already points to an epic.  Is that correct?  If so, you want watch for timing problems with the Issue Created trigger and copy directly from the Epic.

  • trigger: issue created
  • action: re-fetch
  • condition: issue type is Story or Task
  • action: edit issue, setting the labels from the Epic (this is an option from the field edit via the ... at the right side of the field)

What do you want to happen if the Epic Link for an issue changes later?

Kind regards,
Bill

Hi @Bill Sheboy ,

 

Thank you for that suggestion! The automation is working smoothly now. 

Regarding your last question, I want the Issue types to take on the labels for whatever Epic they are currently linked to. 

Is there a rule I can implement for this? 

Like Bill Sheboy likes this

For that use case, you will want a second rule triggered on issue update to copy from the epic.

Unfortunately you cannot use the Issue Field Changed trigger with "Epic Link" as that is not supported yet.  Instead you use the generic Issue Updated and add a condition, such as...

  • trigger: issue updated
  • condition: issue type is Story or Task
  • advanced compare condition: using {{changelog}} to compare for a change in Epic Link
    • first value: {{#changelog.Epic link}}{{fromString}}{{/}}
    • condition: does not equal
    • second value: {{#changelog.Epic link}}{{fromString}}{{/}}
  • and here is the tricky part... using conditions, what do you want to do if the Epic Link is cleared: clear the child's labels or leave them alone?  Add an If/Else condition here to handle what you decide to do
Like Mizael Ponce likes this

@Bill Sheboy Thank you for this information! You just saved me a couple hours of trial and error. 

Like Bill Sheboy likes this

Hi @Mizael Ponce ,

Try how I put in the attached file.

Screen Shot 2022-06-02 at 17.03.47.png

Hi @Claudio Gonzalez ,

 

Thank you for your Input! I edited the Rules to reflect your image (assuming T&A and Linux/Unix are your issue types), however I am still not seeing the label field populate on the Stories/Tasks that I am creating under the Epic. 

I am attaching an image of the Rule Details and Audit Log the for your review. 

 

Is there perhaps a field I need to include on my Epics in order for the Automation to recognize the Issue type and information I am requesting? 
Automation 1 revised.pngAutomation error 1.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,238 views 35 44
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you