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

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

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

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

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

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,316 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot