Hi Team,
I want to write groovy script where user selects options from lets say MULTI -SELECT field
" Environment."
So if users selects ONLY one option "Testing" (just example) for Environment then another field called " Date" should get hidden.
I can work on the part to hide the field but i am unable to get the option when chosen by user , as the multi select field returns array of values and this should be executed only when single option is selected i.e "testing".
Tried this but couldn't apply the logic :
def selectList = getFieldByName("Environment")
def textField = getFieldByName("Date")
def selectedOption = selectList.getValue() as String
if (selectedOption.contains("testing"))
if("testing" in selectedOption)
{
textField.setHidden(true)
}
else
{
textField.setHidden(false)
}
Regards,
Priyanka Nimbalkar.
What about something like this:
def dateField = getFieldByName("Date")
def environmentField = getFieldById(getFieldChanged())
def selectedOption = environmentField?.getValue() as String
def isTestingSelected = (selectedOption == "Testing")
dateField?.setHidden(!isTestingSelected)
Regards
Lasse Langhorn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.