Hello,
I want to show/Hide a field(multi line text box) based on option selected in multi select field. I am using the below code but this only hides the "multi line text box" but never shows-
////////////
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
@BaseScript FieldBehaviours behaviours
def reasonForBlock = getFieldById("customfield_11842") //
def flaggedField = getFieldById("customfield_11829") //
def selectedOption = flaggedField.getValue() as String
log.debug "Selected option: $selectedOption"
if (selectedOption.toString().contains("Other")){
reasonForBlock.setHidden(false)
}
else {
if(reasonForBlock.value)
{
reasonForBlock.setFormValue(null)
}
reasonForBlock.setHidden(true)
}
Can someone help?
Regards,
Priyanka
Hello @Priyanka khare
I had tried to run your script, and it's working fine on my end.
Please correct me if I got you wrong, I understand that you wish only to show the field while the "Other" option was selected on the multi-select field.
May I check if the multi-line text box will never show when you select the "other" option on the multi-select field?
Please make sure that you apply your Behaviour script as a server-side script to detect the changes everytime.
hello,Lih Yao
I also want to try the script.Could I know how you run the script or where you run the script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Sophia Chen ,
To run this script, you should need to install ScriprtRunner in your Jira.
Like I mentioned, please make sure that you apply this script as a Behaviour server-side script.
I would like to suggest you look at this document to understand how the script will work with Behaviour.
I hope this helps. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your answer,Greatly appreciated! However,it‘s too expensive. We might not use this app.
Thanks again for your reply.
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.