Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Check if a field is set to a specific value upon transition (validator)

Bell Lopez November 10, 2021

Hi!

Does anyone know if it is possible to check the value of a field upon issue transition and stop the issue from transitioning if the field is not a specific value? Example:

Single select drop down list called Color with these values:

- Red

- Blue 

- Green

Upon transitioning the ticket from Open to In Approval status, check to make sure the value for Color is not "Red".  If the value is "Red" show an error message that says "Color field cannot be set to red when transitioning to 'in approval'." or something like that.  Hope that wasn't too confusing! 

2 answers

0 votes
Paul Krueger
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 11, 2021

This is exactly what Validators and Conditions are for. If you want to prevent the user from SEEING (and being able to use) the transition, you want to use a Condition. If you want to throw an error when they try to transition, you want to use a Validator. It sounds like you want to use a validator in this case.

You'd want the Regular Expression Check validator. Select your Color field and use this as the regex: ^(?!.*Red).*

I think that will match anything that's not "Red". 

Unfortunately, the Regex validator doesn't let you provide a custom error message like some of the other vadators do (which is odd). If you're set on being able to provide the custom message you could always set up yet another field and some automation. It would look something like this:

Field: ColorIsRed (single-line text box)

Automation: when Color changes, if Color is not Red, set ColorIsRed to No, otherwise, clear ColorIsRed.

Validator -  Now you can use the Field Required Validator on the ColorIsRed field. If it's not populated, you can throw an error stating that "Color can not be red."

meenu_hooda October 11, 2023

hi @Paul Krueger 

I'm trying to use this validator for adding Fibonacci series to Story Points field. But its somehow not working as per the expectation. As per Fibonacci series, I've added the regular expressions as 0, 1, 2, 3, 5, 8. But my workflow if being transitioned to next status even if I add some other values like 12, 21, 13 etc. 

Can you please help me how can I achieve this?

0 votes
Joseph Chung Yin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 10, 2021

@Bell Lopez -

Hi there:

In my opinion, it should be implemented as a "Condition" and not "Validator".  When using condition setup, one will not be able to see the transition if the condition testing is true.

So, user will not be able to see "In approval" transition button to move issues from "Open" status if Color field is already set to RED.  I believe this what you want to achieve right?

Please advise.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Infrastructure Applications Team

Viasat Inc.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events