You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I have a script in a scriptrunner validator to validate a value is populated when another value is selected. Here is the script:
issue.customfield_10177?.value == "Remote Location" ? issue.customfield_10178 != null : true
10177 is a check box
10178 is a text field
When I select that value and leave the text field blank, it is not giving a validation error. Is this because of the field type?
I can confirm we have an example validator located here on line 59, which shows how you can validate that a checkbox field has one specific value selected and that a single line text field is not null.
You can take this validator and use it to help create the validator you need to solve your requirement.
I hope this answer helps.
Is the length of the checkbox field important?
I updated the script to
issue.customfield_10177.value == "Remote Location" && issue.customfield_10178 != null : true
and am now getting an error on all attempts to use this validator:
The following validator rejected the transition: ScriptRunner Script. The configuration is invalid. Contact the app vendor that provided this workflow element.
This error means the Expression failed, as your syntax for the Jira Expression Framework provided by Atlassian which we use is invalid.
Specifying the length of the checkbox makes the syntax correct and means that this is the only value selected.
If you want any of the values in the field to match then I have added a new example here on line 64 that you can use to achieve this.
I hope this helps.