UI policy on cmdb_ci_ip_switch table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 10:30 PM
Hi All,
I am trying to make one specific field mandatory based on the below attached condition. But when I dot walt the location support region field it is not working as expected.
Can someone please advise how I can achieve this and which one is the best way.
1. On Change client script based on location support region field change in cmdb_ci_ip_switch table or UI policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 10:31 PM
it seems the dot walked condition is not working for you
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 11:56 PM
Hello @mohanambalnanja ,
You can use a onChnage() client script
Client Script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var dType = g_form.getValue("device_type");
var fType = g_form.getValue("functional_type");
var location =g_form.getValue("location");
var resion;
var ga = new GlideAjax("Utils");
ga.addParam ("sysparm_name", "getResion");
ga.addParam("sysparm_location",location);
ga.getXMLAnswer(response);
function response(answer){
resion = answer;
//do your validation here
}
}
Script Include:
var Utils = Class.create();
Utils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getResion: function(){
var sysId = this.getParameter('sysparm_location');
var gr = new GlideRecord("cmn_location");
gr.addQuery("sys_id", sysId);
gr.query()
if(gr.next()){
return gr.support_resion;
},
type: "Utils"
});