Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Populate the domain values when a CI changes on incident form

Phanideepthi
Tera Contributor

Hi All,

We have two fields Business domain and Business function on the incident form as shown in the image. Now we are working on getting the values populated on the form when a CI is selected. We have written before insert business rule with the following script.

(function executeRule(current, previous /*null when async*/) {

var ubus = new GlideRecord('cmdb_ci_service_discovered');
    ubus.addQuery('sys_id',current.cmdb_ci);
    ubus.query();
    if (ubus.next()) {
        current.u_business_domain = ubus.u_business_domain;
        current.u_business_function = ubus.u_business_function;
        // gs.print(ubus.u_business_domain);
    }
})(current, previous);
 
Now the issue we are facing is the values are populating once the form is saved instead we need to show when a CI is selected. Any help on this is much helpfull.
Phanideepthi_0-1763139194189.png
 
Thanks in advance.
 
0 REPLIES 0