Good day,
I'm tryingto hide fields based on the value of another field.
Below is my code and it's not doing anything.
import com.onresolve.jira.groovy.user.FormField
FormField dropDown = getFieldById("customfield_10306")
FormField fconditionA = getFieldById("customfield_10510")
FormField conditionB = getFieldById("customfield_10515")
if (dropDownValue.getFormValue() == "High")
{ //Yes
conditionA.setHidden(false)
conditionB.setHidden(true)
}
else
{
f conditionA.setHidden(true)
conditionB.setHidden(false)
}
Jira Service Desk 3.6.1
ScriptRunner 5.1.6
Hello,
You have some of your variables miss-named in the code you provided. I fixed that for you here:
def dropDown = getFieldById("customfield_10306")
def fconditionA = getFieldById("customfield_10510")
def conditionB = getFieldById("customfield_10515")
if (dropDown.getFormValue() == "High")
{ //Yes
fconditionA.setHidden(false)
conditionB.setHidden(true)
}
else
{
fconditionA.setHidden(true)
conditionB.setHidden(false)
}
You also shouldn't need to import FormField, assuming your doing this on a behaviour. Try using the code above as a behaviour on an initializer and let me know your results. If it still isn't working, please send me a screenshot of your behaviour. Also, if you have any questions please let me know!
Jenna
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.