Gunjan Kiratkar
Kilo Patron

 

Hi Jacob, 

 

You can use below change client script which will work both onChange and onLoad :- Remove choices as per your requirement.:-  On Change of state

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
if (g_form.getValue('state') == 1) {
g_form.removeOption('state', '3');
g_form.removeOption('state', '6');
g_form.removeOption('state', '7');
g_form.removeOption('state', '8');
}
return;
}

//Type appropriate comment here, and begin script below
if (newValue == 2) {
g_form.addOption('state', '1','New',1);
g_form.addOption('state', '2','In Progress',2);
g_form.addOption('state', '3','On Hold',3);
g_form.addOption('state', '6','Resolved',4);
g_form.addOption('state', '7','Closed',5);
g_form.addOption('state', '8','Canceled',6);
}


}

 

 

Please mark my answer as helpful/correct if it resolves your query.

 

Regards,

Gunjan Kiratkar

Consultant - ServiceNow, Cloudaction

Rising Star 2022

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy