Forums

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

Using Automation to delete a specific label

Kristin Palmer
Contributor
August 11, 2020

I have an automation that will add a label in specific circumstances.

  • When <custom priority field> = P1, add a "critical" label
  • When <custom priority field> = P2, add an "important" label

My problem is in the scenario where the user is switching around values in this field. I would like the following behaviour:

  • When <custom priority field> transitions from P1 -> P2, remove the "critical" label, add an "important" label, preserve any other labels that might be in the field already
  • When <custom priority field> transitions from P2 -> P1, remove the "important" label, add a "critical" label, preserve any other labels that might be in the field already

I can see how to "reset" the labels field when the rule is triggered by setting it to blank, however I don't know how to preserve the other entries in the label field and only get rid of the now erroneous label.

 

2 answers

1 accepted

0 votes
Answer accepted
Ste Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 11, 2020

Hi @Kristin Palmer 

This is possible to do, within your Action you need to:

  1. Select Edit Issue as the Action
  2. Choose the field to set as "Labels"
  3. Press the breadcrumbs (3-dots icon) next to the drop-down field under the field selected - and select "Add/remove values"
  4. Enter the values to add / values to remove into their respective boxes
  5. Press Save

-------------------

For clarity, this is how I created the rule:

  1. Trigger: Either "Issue Updated" or "Field Value Changed = Field"
  2. Branch: For Current Issue
  3. Condition: If Field = P1
  4. Action: Edit Issue - Labels, add Critical, remove Important
  5. Branch: For Current Issue
  6. Condition: If Field = P2
  7. Action: Edit Issue - Labels, add Important, remove Critical

Tested using the "Priority" field in our instance and it worked in both directions :)

Ste

Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 11, 2020

It's a shame the Add/Remove values option isn't available on a custom field that is a group picker. 

Like Ste Wright likes this
Ste Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 11, 2020

Hi @Curt Holley 

It might be possible using "More Options" - using JSON to add/remove options from the field :)

Ste

Like Curt Holley likes this
Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 11, 2020

I might need more JSON skills for that, but I like your thinking @Ste Wright 

Thanks for the tip!

Like Ste Wright likes this
bilel.arfaoui March 6, 2023

it is possible via this JSON : 

 

{
"fields": {
"labels": [
"{{customfield_yourcustomfieldid}}"
]
}
}

 

This should probably work.

0 votes
Kristin Palmer
Contributor
August 11, 2020

Fantastic, thanks Stephen - I tested this out and it worked. Screen shot for illustration purposes for people who come to search this post in the future. :-) 

Screen Shot 2020-08-12 at 12.23.36 pm.png

Suggest an answer

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

Atlassian Community Events