Use case: Based on 'First' Select Box selected value, Refresh the Second 'Select Box' values for a Service Catalog item in Service Now
Solution
- Create a new 'Catalog Client Script'
- Applies to 'Service Catalog Item'
- Type - 'onChange'
- Catalog Item - Select the appropriate catalog item, for which you want to implement this functionality
- Varaiable Name - 'Select appropriate variable' In this example, First 'Select Box' variable name
- Write the script as below
g_form.clearOptions('state');
var cat = g_form.getValue('country');
if(cat == "usa"){
g_form.addOption('state','WI','Wisconsin');
g_form.addOption('state','TX','Texas');
}
if(cat == "india"){
g_form.addOption('state','AP','Andhrapradesh');
g_form.addOption('state','TG','Telangana');
}
Solution
- Create a new 'Catalog Client Script'
- Applies to 'Service Catalog Item'
- Type - 'onChange'
- Catalog Item - Select the appropriate catalog item, for which you want to implement this functionality
- Varaiable Name - 'Select appropriate variable' In this example, First 'Select Box' variable name
- Write the script as below
g_form.clearOptions('state');
var cat = g_form.getValue('country');
if(cat == "usa"){
g_form.addOption('state','WI','Wisconsin');
g_form.addOption('state','TX','Texas');
}
if(cat == "india"){
g_form.addOption('state','AP','Andhrapradesh');
g_form.addOption('state','TG','Telangana');
}
Thanks for the post, If you are looking for Online Training on ServiceNow go here.
ReplyDeleteThanks for sharing your blog very nice article. Keep posting.
ReplyDeleteservicenow online training hyderabad
servicenow online training india
Very nice article,Thank you..
ReplyDeleteKeep Updating...
Servicenow Admin Online Training