Hi so i have been trying to hide a field when my previous field has a particular selection out of a list of three namely None, sick, casual
I want the reason for the leave field to be hidden in case type of leave is sick or casual
in case it is None i want it to be accesible
Ive been trying behaviour but had no luck maybe im going wrong somewhere if someone could guide me thank you
-----------------------------
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def approver = getFieldByName("reason for the leave")
def tOL = getFieldById(getFieldChanged())
def selectedOption = tOL.getValue() as String
if (selectedOption == "None") {
approver.setHidden(true)
} else {
approver.setHidden(false)
}
Hello @Gagan Inder Sekhon
None option is null, so script should be like this
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def approver = getFieldByName("reason for the leave")
def tOL = getFieldById(getFieldChanged())
def selectedOption = tOL.getValue() as String
if (selectedOption == null) {
approver.setHidden(true)
} else {
approver.setHidden(false)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.