Forums

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

Hiding a field off a Cascading Select List

AndrewP January 10, 2020

OnPrem JIRA Ver 8.1.2

I am using a Cascading Select field that essentially has a list of values for apps in the first list followed by the actual work being done in the second field.

ex. JIRA / Upgrade

I have another field that is called JIRA Projects which lists all the Projects in our JIRA instance. It is only used when the request is a JIRA request. I want to hide that field if the Cascading Select field first selection, is anything but JIRA.

ex. ServiceNow / ....   Then hide the JIRA Project field.

I am using Behaviors which works fine on other Projects and I tested with this Project/Screen and so on using another field that is not a Cascading Select List and it works fine.

So this issue appears to be that it's a Cascade Select List.

Here is my code...

Select "Application Request - Type of Work)

def ptpiField = getFieldByName("JIRA Project")
def ppField = getFieldById(getFieldChanged())
def selectedOption = ppField.getValue() as String

if ((selectedOption == "JIRA"))
{
ptpiField.setHidden(true)
}
else
{
ptpiField.setHidden(false)
}

Again... This works with a normal List of Values field just fine.

 

Do I need to add secondary values to get it to work? If so - what does that look like here?

if ((selectedOption == "JIRA"))

Any help is appreciated.

 

1 answer

0 votes
Jorden Van Bogaert
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 10, 2020

Hi @AndrewP 

I'd update the if statement to check

selectedOption.contains("JIRA")

 This way you don't need to worry about how the data from a cascading select field is presented.

Hope it helps

Kind regards
Jorden

AndrewP January 10, 2020

Thanks - I set the following with no change.

def ptpiField = getFieldByName("JIRA Project")
def ppField = getFieldById(getFieldChanged())
def selectedOption = ppField.getValue() as String

if ((selectedOption in "Jira"))
{
ptpiField.setHidden(true)
}
else
{
ptpiField.setHidden(false)
}

AndrewP January 10, 2020

Also - I am fine with defining the secondary field options - there are only 5 and it's likely I will have to know how to configure that anyhow. For example if the secondary field if "integration" then I need to show a multitude of integration fields which need to capture data at the Create moment.

Suggest an answer

Log in or Sign up to answer