How can I check for when a specific label has been added or removed?

Simon Weil July 18, 2019

I want to trigger an action when label 'mylabel' has been added or removed.

It should not trigger when a label containing 'mylabel' has been added or removed, for instance 'mylabel1' or '111mylabel-2'.

How can it be done?

1 answer

1 accepted

0 votes
Answer accepted
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 19, 2019

Hello Simon,

JIRA Post functions only triggers upon issue transitions. That been said, you will need a plugin to trigger any action when an issue is edited - More specifically when a new label is created.

You can use Automation for JIRA App to configure a rule that will trigger upon a new label creation, adding the condition that this label must not contain "mylabel":

Screen Shot 2019-07-19 at 17.22.10.png

Let me know if this information helps.

Esther Strom
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 27, 2020

@Petter Gonçalves I know this is a year old, but I have a similar requirement. 

From what I can tell, your solution doesn't tell us that the ticket previously had a label of "mylabel" and now it doesn't; all it tells us is that at the time the rule is triggered, there is no label of "mylabel" - the ticket may never have had that label. Is that correct?

My requirement is to trigger a rule when a specific label is removed from a ticket, as we have Plans (advanced roadmaps) set up pulling from a label and if someone accidentally (or not) removes the label then the issue disappears from the plan. I've looked at smart values, and see that there is a fieldChange.fromString and fieldChange.toString, but I'm not sure I can use those in this kind of rule. Can you help me out?

Like Masudur Rahman likes this
Masudur Rahman September 16, 2020

I had the same requirement and did the following tedious way. This might be helpful if you still need to fulfil your requirements. 

labels-removed-event-catch.png

 

Thanks

Masud

Like # people like this
Ganesan Chandrasekaran March 12, 2021

Thanks for sharing this. How to use .fromString and .toString on arrays like labels. 

Like Chris Buzon likes this
Wojciech Wardaszko _HeroCoders_
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 3, 2022

I know it's been ages, but I just found this and it's very useful, thanks!

For the array to string issue, looks like this list.join smart value function will do the trick.

Chris Buzon
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.
April 26, 2023

Masudur this is brilliant and useful.  Thanks!

Suggest an answer

Log in or Sign up to answer