I'm trying to add a Behaviour by ScriptRunner to make a field required if in another field multiple values are selected. But it seems the code I created is not working for checkbox field.
For example, I have follwoing fields:
"Field1" - text field type
"Field2" - checkbox field type with a following values: 1, 2, 3, 4
And on issue creation I need "Field1" be required only if 1 and/or 2 values are selected in the "Field2".
Code example I used:
const field1 = getFieldById("field1id");
But it doesn't work at all. I've tried different options for getting values from the "field2" change, but failed in this. What am I doing wrong?
I found a few solutions for the same requests in community but they were for Jira Server, while I'm using Jira Cloud and those solutions didn't help.
Thanks in advance!
Hi Julia,
Thank you for your question.
I can confirm that you can use the approach in the example script here to make a text field required when a value is selected in a checkbox field.
This script makes a select list when an option is selected in a multi-select list field. You can update this part to make the text field required.
Also, in your case, you will need to duplicate the changeField condition to check if it is either option by making it like changedField.getValue().some(item => item.value === "1") || changedField.getValue().some(item => item.value === "2")
I hope this helps.
Regards,
Kristian
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.