
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 11:05 AM
I'm doing a g_form.getReference on the cmdb_ci field in a client script for incidents. I'm trying to dot walk to a specific filed that is part of a specific class. The filed is only on this class and when I do ci.u_service_level I get undefined. What do I need to add to be able to get that field thought a dot walk via script? Or am I going to have to do a GlideRecord query? Below is my script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
g_form.getReference('cmdb_ci', function(ci){
if (ci.sys_class_name == 'u_cmdb_ci_myclass'){
alert(ci.u_service_level);
}
});
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 11:39 AM
And I would recommend doing a GlideAjax call fore this as well to make sure you get the information you really want.
LinkedIn & Twitter
Subscribe to my YouTube Channel
Buy The Witch Doctor's Guide To ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 11:15 AM
Hi Brian,
Dot-walking doesn't work with getReference since the client side only fetches the value that specific record has. it has no clue what values the dot-walked field has. This is one of the reasons ServiceNow doesn't recommend using it anymore. I think you will need a good old GlideAjax call here.
LinkedIn & Twitter
Subscribe to my YouTube Channel
Buy The Witch Doctor's Guide To ServiceNow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 11:20 AM
But I can dot walk to the sys_class_name without issue otherwise my alert would never get called. I have check other CIs that do not have that class and the alert does not appear.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 11:28 AM
I think I read it to fast, what you do isn't "dot-walk". Since Dot-walk usually means that you go to another record. Like if I have a incident record as current I can type current.caller_id and I'm not dot-walking, but current.caller_id.email is. Since then I need to go into the caller record to get the email address. The caller_id value is on incident.
But your problem seems strange. if you use getDisplayValue, does that work?
LinkedIn & Twitter
Subscribe to my YouTube Channel
Buy The Witch Doctor's Guide To ServiceNow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 11:35 AM
Where exactly do you want me to try getDisplayValue? I notice when I try to search for incidents with the u_service_level = 3 I get the following in the encoded query so I'm not sure if there is special scripting I have to do for this or it will not work.
cmdb_ci.ref_u_cmdb_ci_myclass.u_service_level=3