GlideAjax: Unable to Fetch OS and OS Version for Server Class CI on Incident Form

KarangulaB
Tera Contributor

I'm trying to implement a GlideAjax scenario where, whenever a Server Class CI is selected in the Configuration Item field on the Incident form, the Description field should be auto-populated with details from the selected CI. The details include:

  • Asset Tag

  • Company

  • Operating System

  • OS Version

I have written the necessary client and server-side code using GlideAjax, and the functionality is working partially. The Asset Tag and Company are populating correctly, but the Operating System and OS Version are returning as undefined.

 

I'm attaching the screenshots of the code and form behavior for reference.

 

Screenshot 2025-04-25 at 12.27.29.pngScreenshot 2025-04-25 at 12.31.28.pngScreenshot 2025-04-25 at 12.40.30.png

 

Could someone help me understand why OS and OS Version are not being retrieved, and how I can fix it?

1 ACCEPTED SOLUTION

J Siva
Tera Sage

Hi @KarangulaB 
OS and OS version belong to the 'cmdb_ci_server' table. You are querying the 'cmdb_ci' table, where those fields are not present.

So, modify your code to Glide through the cmdb_ci_server table. PFB the test run results from my pdi.

JSiva_1-1745650235640.png

 

var ci = new GlideRecord('cmdb_ci');
ci.get('27e59e75c0a8000b003b3fab4211d2c2'); //CI sys id
gs.print("CMDB CI table OS: "+ci.getDisplayValue('os'));
gs.print("CMDB CI table OS Version: "+ci.getDisplayValue('os_version'));
gs.print("------------------------------------------");
gs.print(" ");
gs.print("------------------------------------------");
var ci1 = new GlideRecord('cmdb_ci_server');
ci1.get('27e59e75c0a8000b003b3fab4211d2c2'); //CI sys id
gs.print("CMDB CI SERVER table OS: "+ci1.getDisplayValue('os'));
gs.print("CMDB CI SERVER table OS Version: "+ci1.getDisplayValue('os_version'));

Output:

JSiva_0-1745650218548.png

Regards,

Siva

View solution in original post

3 REPLIES 3

J Siva
Tera Sage

Hi @KarangulaB 
OS and OS version belong to the 'cmdb_ci_server' table. You are querying the 'cmdb_ci' table, where those fields are not present.

So, modify your code to Glide through the cmdb_ci_server table. PFB the test run results from my pdi.

JSiva_1-1745650235640.png

 

var ci = new GlideRecord('cmdb_ci');
ci.get('27e59e75c0a8000b003b3fab4211d2c2'); //CI sys id
gs.print("CMDB CI table OS: "+ci.getDisplayValue('os'));
gs.print("CMDB CI table OS Version: "+ci.getDisplayValue('os_version'));
gs.print("------------------------------------------");
gs.print(" ");
gs.print("------------------------------------------");
var ci1 = new GlideRecord('cmdb_ci_server');
ci1.get('27e59e75c0a8000b003b3fab4211d2c2'); //CI sys id
gs.print("CMDB CI SERVER table OS: "+ci1.getDisplayValue('os'));
gs.print("CMDB CI SERVER table OS Version: "+ci1.getDisplayValue('os_version'));

Output:

JSiva_0-1745650218548.png

Regards,

Siva

Thanks a lot! I updated by querying cmdb_ci_server, now I’m able to fetch the OS and OS Version fields correctly.

@KarangulaB Glad it helped 👍