Jira Data Center Version 8.20.1
Script runner 6.46.0
I am using the behavior option in script runner to require/show a text field based on a value in a list field. Using debug logging it works but never gets into the if statement. I set the behavior on Affected Artifacts field as that is the list I am getting the value.
Below is my code
def.af = getFieldByName("Affected Artifacts")
def afo = getFieldByName("Afftected Artifacts (Other) ")
afo.setHidden(true)
if (afVal == "Other) {
afo.setHidden(False)
afo.setRequired(true)
{
Apply Behaviour on AF field and add below script, You are missing getValue in your script :-
def af = getFieldByName("AF")
def afo= getFieldByName("AFO")
log.debug("dropdown value" + af.getValue())
if (af.getValue() == "Other") {
afo.setHidden(true)
}else {
afo.setHidden(false)
}
Thanks
@Nannette Mori Kindly share the complete script which you applied on af (select list field) behaviour. Might be some mistake in script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think it can execute the if statement.
You start it with "if (afVal ==", but your script does not define afVal, so the script has to evaluate the if as false.
I think you need to add a line like
def afVal = af.value
or change line 1 to
def afVal = getFieldByName("Affected Artifacts").value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I apologize
I inadvertently left this out of my script example, I had this line before the If statement
def afVal = af.getValue().toString
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.
Can you give us the whole script?
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.