06-07-2017 02:03 PM
I write the catalog client script for get the category and sub category list from the custom table. script is working perfectly on the instance but not
on the service portal. In the catalog client script, i tried with the UI Type is mobile , desktop,both but script is not working. please see the below is the on change
catalog client script what i wrote. Please help me about this problem .
function onChange(control, oldValue, newValue, isLoading) {
if(newValue == oldValue){
return;
}
//remove all items from subcat drop down to start
// Used the g_form.clearOptions() function instead of g_form.removeOption() function
g_form.clearOptions('bofi_what_role');
if(newValue=='none') {
//g_form.setValue(bofi_what_role, '--None--');
g_form.clearOptions('bofi_what_role');
//build a new list of dependent options
}
var gp = new GlideRecord('sys_choice');
gp.addQuery('dependent_value', newValue);
gp.addQuery('element', 'u_application_role');
gp.query();
while(gp.next()){
g_form.addOption('bofi_what_role', gp.value, gp.label);
}
}
06-07-2017 02:15 PM
Hi Vamsi,
You need to use callback in your GlideRecord query.
Please refer below post for resolution.
Catalog Client Script on Service Portal is not working
Regards,
Sachin
06-07-2017 04:49 PM
Do you have a variable called bofi_what_role on your form? On sys_choice.list, do you get any results if you apply the filter element = u_application_role and dependent_value = (whatever value bofi_what_role) is?