Hi Community,
I have created a Select List (Multi-Choose) field with 10 options, and 10 Text fields.
The Text fields should hide/ show based on the selected options present in Select List (Multi-Choose) field.
For example:
Please guide with a sample code on how to configure the above use-case by using scriptrunner, jmwe-app, or jira automation if possible?
Thanks
Yes, you can achieve this using ScriptRunner Behaviours in Jira. Behaviours give you more control over fields in Jira, such as allowing you to dynamically control the visibility of fields based on the selections made in other fields.
Here’s an updated sample script based on your specific use case:
Steps:
1. Go to ScriptRunner > Behaviours.
2. Create a new Behaviour and map it to the appropriate issue type or project.
3. Add the following script to the Behaviour of your Multi-select list field.
def myField = getFieldById(getFieldChanged())
List multipleValue = myField.value as List
def textField1 = getFieldByName("Text Field 1")
def textField2 = getFieldByName("Text Field 2")
// Hide all text fields by default
textField1.setHidden(true)
textField2.setHidden(true)
// Show relevant text fields based on selected options
if (multipleValue.contains("Option 1")) {
textField1.setHidden(false)
}
if (multipleValue.contains("Option 2")) {
textField2.setHidden(false)
}
for more info regarding how ScriptRunner behaviours work, here is the documentation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.