/* * This script provides an example of how in Behaviours to make a Select List field required when a specific value is selected inside a Multi Select List field. * All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner * license shall be granted a non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed * or amended and must be included in any circumstances where the code snippet is shared by You or a third party." */// Change below to the Name of your Multi Select list field constmutiSelectFieldName="Demo Multi Select"// Change below to the ID of your Select list field constselectListField=getFieldById("customfield_10072");// Access the changed Field ValueconstchangedField=getChangeField()// If changed field is the Multi Select Field and Option A selectedif(changedField.getName()===mutiSelectFieldName&&changedField.getValue().some(item=>item.value==="A")){// Change "A" here to the value in your Multi Select List Field that must be selected // Make the Select list field requiredselectListField.setRequired(true);}else{// Make the Select list field optional when A not selectedselectListField.setRequired(false);}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.