Hi Team,
I have requirment, based on one custome field another custome field need to show or hide,
I have a code which is working fine for Single select field, but when I applied the same for Multislect field its not working.
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
log.warn("--- Start Behaviour ------------------------------------")
//partials Multiselect field
def Partial = getFieldById("customfield_14544")
log.warn("Partial = $Partial")
//Minor Text field
def Minor = getFieldById("customfield_14545")
log.warn("Minor = $Minor")
def PartialValue = Partial.getValue()
log.warn("Partial = $PartialValue")
if (PartialValue == "Others" ){
log.warn("Version set to hidden!")
Minor.setHidden(false)
Minor.setRequired(true)
}
else {
log.warn("Version set to hidden!")
Minor.setHidden(true)
}
log.warn("------------------------------------ End Behaviour ------")
Working fine now with help of
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
log.warn("--- Start Behaviour ------------------------------------")
def multisSelectList = getFieldById("customfield_14544")
def Text= getFieldById("customfield_14545")
// Get the Value of My Select Field
def selectVal = multisSelectList.getValue()
// If the first option is selected in the multi select list then make the text field required.
if(selectVal.toString().contains("Others")){
Text.setHidden(false)
Text.setRequired(true) // Make text field required
else {
Text.setHidden(true)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.