We want to create an automation that adds a label of "severity_increased" or "severity_lowered" when our severity field on a JSM ticket is moved up or down (For context, clients may raise service desk issues at a higher severity than is appropriate so we need to de-escalate them and vice versa).
I can see that its possible to add a label with the field being edited in any way, which would be perfect if we just wanted to log that it was changed, but can I define which label is used if it moves from one value to another.
i.e. severity modified from Critical to High, Medium or Low = add label "severity_lowered".
Hello @Dean Mervin _He_Him_They_
Welcome to the Atlassian community.
Yes, you can do that with Automation.
With the Field Value Changed trigger you get access to the values of the field before and after the change with the special smart value {{fieldChange}}
https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/#Field-value-changed
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--
You can use Conditions to evaluate the before and after values and then edit the issue to add the Label value that is appropriate.
Ok so I can get it to do one of the actions, but not the other...
This is how I've got the first IF block set up, so I've got it going from the higher severity values down to any lower severity value, and adding the severity_lowered label.
The ELSE block is then just for anything that isn't that, adding the label of severity_increased.
The severity_lowered label is applied, even when those conditions aren't met, so going from Low to Critical I still get the label of severity_lowered.
I'm now stuck 😅 do I just need to do another automation that's a mirror for the changes going in the opposite direction? Rather than trying to use IF/ELSE?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Dean Mervin _He_Him_They_
So, first thing, the smart value {{fieldChange}} should not be preceded by issue.
Don't use {{issue.fieldChange...}}
Do use {{fieldChange...}}
Second, you are trying to access things that are not part of the {{fieldChange}} structure; namely fromHigh, toLow, fromMedium, etc. The {{fieldChange}} smart value has very specific attributes you can access as detailed here:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--
If you want to reference the value of the field before it was changed you use {{fieldChange.fromString}}. If you want to reference the value of the field after it was changed you use {{fieldChange.toString}}
In my environment the Severity values are Sev-0, Sev-1, Sev-2, Sev-3, going from highest severity to lowest severity.
To determine if the Severity has been decreased I can use If/Else blocks like this.
You would make a series of if/else blocks to check for severity decreases, and then a set checking for severity increases.
There may be a more elegant/efficient way to do this, but this seems to work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are a superstar, thankyou that works perfectly.
I was getting a bit overzealous adding in the issue bit at the beginning, from past experience I thought that needed to be added in too 🤦
Much appreciated!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.