Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Client Script to update the Choice List on the Subcategory field based on the Company

simonbourne
Kilo Contributor

I have a Category of Software and a list of applications defined in the Subcategory.  These are configured via Choice List.

I want to remove one application from the Subcategory list when a specific Company is selected.

I have done something similar via an OnChange Client Script based on the Company field but I can't get this to work.  This is the script I have....

find_real_file.png

The sys_id is the correct sys_id for the Company.

Where am I going wrong?

7 REPLIES 7

The Subcategory value in question appears for 2 different Category values

Try below script.

 

var category = g_form.getValue('category');

if(newValue == '86c1f3193790200044e0bfc8bcbe5d95' && category == 'software')  //copy your company sysid
{

g_form.removeOption('subcategory', 'sonata'); //sonata - choiceValue
}
else
{
g_form.addOption('subcategory', 'sonata', 'Sonata'); //fieldName, choiceValue, choiceLabel
}

You have to write one more  OnChange Client Script based on the Category.