
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 04:05 PM
Hello Guys,
I am trying to understand the process to get the data of reference fields.
Example:
A REQ000111 has Opened_by reference filed and is referred to User table. And on the user table, another reference field is called Location.
The Location has different variables. Example City, Country, etc.
How can we get the value of City or State without using Script Include?
Help on this is much appreciated.
Thanks,
Raj
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2022 03:36 AM
Thank you
Looks like have to use script include, without which the values are not retrieved.
Code for reference:
Script Include:
getlocation: function() {
var sys = this.getParameter('location_id');
var cm_loc = new GlideRecord('cmn_location');
if (cm_loc.get(sys)) {
gs.log('location ' + cm_loc.country);
answer = cm_loc.country;
gs.log('answer' + answer);
}
return answer;
},
Client Script:
var l = g_form.getReference('opened_by');
var ll = l.location;
ga.addParam("sysparm_name", "getlocation");
ga.addParam("location_id", ll);
ga.getXMLWait();
// alert(ga.getAnswer());
var loc = ga.getAnswer();
alert(loc);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 06:39 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 11:54 PM
Hi Sudeep,
Thank you, but I am looking more on the jelly or the client scripts to get the values.
Thanks,
Raj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2022 03:36 AM
Thank you
Looks like have to use script include, without which the values are not retrieved.
Code for reference:
Script Include:
getlocation: function() {
var sys = this.getParameter('location_id');
var cm_loc = new GlideRecord('cmn_location');
if (cm_loc.get(sys)) {
gs.log('location ' + cm_loc.country);
answer = cm_loc.country;
gs.log('answer' + answer);
}
return answer;
},
Client Script:
var l = g_form.getReference('opened_by');
var ll = l.location;
ga.addParam("sysparm_name", "getlocation");
ga.addParam("location_id", ll);
ga.getXMLWait();
// alert(ga.getAnswer());
var loc = ga.getAnswer();
alert(loc);