Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

How to set custom field mandatory based on cascading custom field option?

M. P.
Contributor
April 16, 2015

In our case CascadingField is an cascading custom field that includes Option A and Option B, this Options has several Values. So we need CustomFieldRequired to be required, when CascadingField = OptionA.ValueB, while performing Close transition.

However we do not need this Close tranistion to be hidden. Therefore I didn't added the condition.

I have tried the simple script by adding cfValues['CascadingField '] == 'OptionA.ValueB' as a validation to the Close transition and additionally I have added "Field Required" Validator for CustomFieldRequired. But it doesn't work.

When I'm performing "Close" transition the CustomFieldRequired is required as CascadingField is set up to OptionA.ValueB, but when the CustomFieldA is filled, it still askes me to fill it in. Why ? How can I fix it ?

I also tried following script

(cfValues['CascadingField']?.get(null) == 'OptionA' && cfValues['CustomFieldRequired'] != "") and it doesn't works. I don't want to use Behaviour Plugin or addittional plugin as I'm sure that it can be done with Scrip Runner functions.

THanks in advance!

4 answers

1 accepted

1 vote
Answer accepted
M. P.
Contributor
April 28, 2015

Was solved with following Script

if (!issue.fixVersions && (cfValues['CascadingField']?.values()*.value[1].contains("OptionA")||(cfValues['CascadingField']?.values()*.value[1].contains("OptionB")))) return false else return true
0 votes
JamieA
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.
April 24, 2015
0 votes
M. P.
Contributor
April 24, 2015

I have tried also following (cfValues['CascadingField ']?.get(null) == 'OptionA' && issue.fixVersions != null) (cfValues['CascadingField']*.value.contains("OptionA") && issue.fixVersions != null) and it didn't work

0 votes
M. P.
Contributor
April 24, 2015

@Jamie Echlin [Adaptavist] maybe you could answer this question sinces Script Runner is your plugin smile

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events