Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA show and Hide Customfields based on customfied select list

Vinod
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 18, 2020

@RambanamP 

Hi, This is my requirement. When I select custom field Select list I would like to show or hide other customfields(SelectList, and Text).

 

I have Single Select  Custom Fields "Services" with Values A,B,C,D. If A is selected, I would like to show  Select List customfield and Text Field. If B is selected, I would like to show different set of select List CF and Text Field. 

I tried the Behaviour script and it is not working. 

def ServiceRequest = getFieldById ("customFieldId_10905")
def Consultation = getFieldById ("customFieldId_10911")
def pulltype = ServiceRequest.getValue()
if (pulltype == "10623") {
Consultation.setHidden(true)
} else {
Consultation.setHidden(fals

1 answer

0 votes
Prasad Rambanam[ACIS] September 18, 2020

You can try  with following code

def cfServiceRequest = getFieldById ("customFieldId_10905")
def serviceRequest = cfServiceRequest.getValue() as String
def Consultation = getFieldById ("customFieldId_10911")
def textField = getFieldById ("customFieldId_10912") //change field id

def selectList = getFieldById ("customFieldId_10913") //change field id
def textField2 = getFieldById ("customFieldId_10914") //change field id

if (serviceRequest == "option name1") { //change option name
Consultation.setHidden(false) //display field
textField.setHidden(false) //display field
} else {
Consultation.setHidden(true) //hide field
textField.setHidden(true) //hide field
}

if (serviceRequest == "option name2"){ //change option name
selectList.setHidden(false) //display field
textField2.setHidden(false) //display field
} else {
selectList.setHidden(true) //hide field
textField2.setHidden(true) //hide field
}

 

I don't have time to optimize the code so you can do that !!

Suggest an answer

Log in or Sign up to answer