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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to make a text field required based on the selection of another field

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?

1 answer

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 10, 2023

Hi Todd,

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.

Regards,

Kristian

@Kristian Walker _Adaptavist_ 

Is the length of the checkbox field important?

I updated the script to

issue.customfield_10177[0].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.
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 15, 2023

Hi Todd,

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.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events