Hi all,
I have a custom field from type Select List.
I would like to make a different custom field required when this select list field's value is equal one of 3 options (the select list contains 7 options total).
I'm trying to set this rule via Workflow validator with the use of Script Runner. If I would have liked to be based on just one of the values in the select list, I could have used this with no problem:
cfValues['selectListCF']*.value.contains('ticketCanBeCreated') || cfValues['selectListCF']*.value.contains('oneOfTheOptionsThatRequiresMandatoryValueInOtherCF') && cfValues['cfIWantToMakeMandatory']!=null
Is there an option to choose more than one value of a select list using Script Runner?
Thanks guys
You could do as Marten said but easier would be:
['ticketCanBeCreated', 'oneOfTheOptionsThatRequiresMandatoryValueInOtherCF'].contains(cfValues['selectListCF'].value)
Don't know use *.value unless it's a multiselect.
But wouldn't this enable tickets for any of the selectList values? He just wanted it enabled for 3 out of the 7 possible values
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jamie, you solution worked like a charm. Exactly what I was looking for.
Thanks for the quick reply. Love the plugin :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, I somewhat misread your code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't really understand the question. The way I read it oneOfTheOptionsThatRequiresMandatoryValueInOtherCF was one of the options.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Without knowing to much about Script Runner, I would recommend an easy work-around by creating two workflow validators (one for each value). You should be able to link them together with the help of jiras workflow editor to create a similar "OR" logic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the answer, Marten. The creation of more workflow steps did was something I considered, but since it might end-up with doing a lot of maintenance work I wanted to make sure all other options are covered. Have a good day
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.