Automation for Jira: Trigger if certain label was added. How?

flaimo July 22, 2020

I am struggling with a case, where I would like an automation rule to trigger if a certain label was added. I can use the "field value changed" trigger, but this doesn't allow to check if some specific label was added or removed. How do I do this?

1 answer

1 accepted

1 vote
Answer accepted
Robert Levelind July 22, 2020

Hey @flaimo - you are almost there!

When: Value changes for "Labels"

If: Labels contain any of (Label of your choice)

Then: Actions you want performed

flaimo July 22, 2020

this doesn't work. it triggers every time, regardless if the label was added, or if it was already there before (and the rule was triggered because another label was added).

Robert Levelind July 22, 2020

It will always be triggered because a value changed - the important thing here is if the IF condition kicked in or not :) do you mind sharing your current recipe? 

Robert Levelind July 22, 2020

Misunderstood the issue at hand - I figured it out:

Screen Shot 2020-07-22 at 14.54.05.png

So you basically have to make a double IF check here comparing the fieldChanged before and exclude it from the trigger if it was already there.

Like # people like this
flaimo July 23, 2020

that did it the trick. thanks for the example.

Michelle Woodbury April 12, 2022

This does not work for me; would someone be able to provide guidance? 

Automation 1.png

Joost Jonker January 10, 2023

Hi @Michelle Woodbury

I had to use {{fromString}} to make it work. This has probably changed since 2020.

Norberto Henriques February 9, 2023

If you use fromString, you may risk having a "true" condition if there is a label that contains all the text of the string you're checking.

Eg: For_qa_validation in labels, if you check for qa_validation it would still match although there is no label with just "qa_validation.

I was trying to use the raw value {{fieldChange.from}}, but it does not seem to do the trick now.

Like Joost Jonker likes this
Omer Ronen August 17, 2023

How do I add the "And: compare two values checks if" in Jira Prem? is that possibale? 

sergei_lavrov December 28, 2023

This is a fieldChange object contents:

ChangeItemBean{fieldId='labels', field='labels', fieldType='null', from='null', fromString='', to='null', toString='test'}

Just leaving this here, cause i needed it to understand the mechanism.

Thanks for the solution people, it really helped.

Eran Nir February 13, 2024

Hi, @flaimo @Norberto Henriques 

We have Jira Server version.

 

I would like to send Slack msg to a Slack channel, when I add/set Label- "X" to an existing (not in creation of a ticket)  Jira ticket (notthnaks.

 

which solution should I use? is it possible w/o automation add on?

Thanks

Suggest an answer

Log in or Sign up to answer