Add a label using Automation, without changing/removing existing labels

Alex Bernardin February 21, 2020

Using the Automation add-on, I want to have a rule/action such that on a specific transition, a label gets added to the labels field.

When I set this up using the 'Edit field' action, I found that the new label would be applied, and existing labels would be removed. 

Wondering if there is a different action I can use to add a value to a field without replacing the existing field value?

3 answers

1 accepted

9 votes
Answer accepted
Alex Bernardin February 21, 2020

aaaaaand, as so often happens, I've answered my own question.

When you use the Edit Field action, there's a text field for entering the new value.  To the right of that field there's an elipsis overflow menu icon.  Clicking that icon gives you options for adding or removing explicit values from the field, instead of just replacing the field. 

Project automation - JIRA 2020-02-21 09-44-42.png

Angelo C June 8, 2021

Thanks for this post. I got caught in this and didn't see the hidden menu.

For the sake of clarity, the top field is for values you want to add to the issue.  If you want to keep the other values intact, you leave the bottom field blank.

Like # people like this
Tom Stratton August 6, 2021

What Angelo said!

Like Danny Bish likes this
Doug Reading March 17, 2022

Same here. I completely missed this, thanks for sharing!

Like Danny Bish likes this
Sylvain Leduc May 2, 2022

Hello @Alex Bernardin 

Interesting, I thought the field "organization" as a label too, was working like "labels" but there is no such extension (3 dot button) for it. Unfortunately.

Alex DePaul May 31, 2022

@Alex Bernardin Any thoughts as to why Component/s doesn't give me the option to Add/Remove values?  

temporary.jpg

Like # people like this
Catherine Reid April 6, 2023

@Alex DePaul I don't think the add/remove is available for every field.  I see it for 'labels' but I don't see it for a custom field I have or the components field. 

Adam Ziecik April 28, 2023

Hello All,

 

I am trying to set up an automation that will not only do what is described here, but also remove the label based on custom field value i.e. if you select Team A in a custom field, the value would be copied to Labels, but it you select Team B, then the automation would remove Team A from labels and add Team B as a label. 

 

Anyone, any ides for how to achieve this?

1 vote
Julia Anderson August 16, 2022

This 'add/remove' setting is still replacing existing labels for me and not adding. Any help would be appreciated!

Harald.Conradi September 20, 2022

@Julia Anderson 

I learned the hard way today that all previous labels were removed when Automation added my "Sprint/Planned" label.

Based on the above tips (thanks, all!), I've made edits.

I'm using ... > Add/remove values

  1. Top Row is "Values to add" - the label I want to add
  2. Bottom row is left blank (based on above tips), so that should leave the other, pre-existing Labels values intact.

I'll find out in 2 weeks if this worked as intended. :-)

Capture.PNG

Like Emily Henson likes this
Julia Anderson September 20, 2022

Thanks for the response @Harald.Conradi. I am also using that solution to no avail.  

Alex DePaul September 21, 2022

Hi! The fix for me was to select "copy from issue" and then add the new label. 

Snag_51ee2410.png

Erik Starke October 5, 2022

Hi, this is what I did @Alex DePaul with 5 automations that all shall set different labels but not overwrite each other. The automation result is a "success" whenever the condition is met, but it still overwrites them. Oddly enough, SOMETIMES there are 2 labels though.
That made me double check but no, all rules are configured with the "Copy from issue" attribute.
Anybody with an idea? 

Like Stephen Aroza likes this
Stephen Aroza December 2, 2022

Facing the same issue. 2 automation rules to add labels are overwriting each other even when the rule is added with Add/remove values.

From what I see, the issue is because both automations are running simultaneously and label just changes from None -> label

Is there a way we can introduce a delay on some automations?

Erik Starke December 5, 2022

Hey Stephen, I found a solution to my problem. 
After adding 1 label via automation, you can use another automation action called "Re-fetch issue data". 
If you use that, the automation will update the labels and keeps them if you wanna add more than one.

Stephen Aroza December 5, 2022

Thanks, @Erik Starke! This definitely helps alleviate many cases. However, still found cases where one of the labels is being overwritten. Feel there might not be a solution to this?

BG Pantaleon December 19, 2022

Same issue here. I tried re-fetch but still getting overwritten by another Label.

DHARMADURAI R June 29, 2023

how can i add label using smart values?

Like Lord Pablo likes this
0 votes
Adrian Szubert August 10, 2023

Hello!

I was creating the automation where I wanted to get Labels from trigger issues + Add one more label. Tried a few solutions provided in the comments, but nothing worked for me. In the end, with some trials, I came up with the following solution:

1. Trigger: Issue Transitioned in Workflow to a certain status

2. Create a new: Task, and there in the options for Labels I have provided "Add Labels from Parent issue" -> changing it to trigger issue does not work (it wipes them out, not sure why)

3. Re-fetch issue Data

4. Edit issue field: Add the Labels you want to see

 

Hope it helps, or maybe someone can explain the difference between Parent and Trigger in this context - here those are exactly the same issues, but maybe in other scenarios it takes a different approach.

Suggest an answer

Log in or Sign up to answer