- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2024 11:08 AM
Can we dot walk more that 1 level using getReference in Client Script.
In my case I'm not able to do that, it is returning "undefined".
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2024 12:16 PM
You are unable to dot-walk further than just the field on the table you getting the reference from.
Any further dot-walking would instead need to be done through GlideAjax and then passed back to the client.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 09:08 AM
Hi all,
After doing some research I have concluded the following.
1) We can only dot walk single level using getReference function.
2) If we need to dot walk up to multiple level then we should use GlideAjax or g_scratchpad.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2024 12:08 PM
Hi @HrishabhKumar ,
Actually you are using wrong syntax of g_form.getReference. Please check below script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below department
var userref = g_form.getReference('caller_id', userLookup);
function userLookup(userref) {
alert("Name = " + userref.department);
g_form.setValue('description', userref.department);
g_form.update();
}
}
Here you can get the sys_id of caller's department(if present) in alert.
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2024 12:46 PM
Hi @Community Alums ,
Thanks for you response.
This not a wrong syntax, this is one of the way to use getReference. FYI you can use getReference in two ways
1) without callback fucntion (Synchronous)
g_form.getReference('caller_id').manager.email
2) with callback function (Asyncronous & Recommended)
The one you specified in the reply.
But anyways my question was can we do multiple level dot walking using getReference() function. I'm already able to get the sys_id of manager using the Synchronous method, I'm looking for the email of the manager, for that we will have to dot walk 2 levels.
first caller_id.manger
second caller_id.manager.email
According to my knowledge and confirmation from @Allen Andreas , We can only do one level dot walking in getReference function.
I hope my doubt is clear to you now.
Thanks & Regards
HRISHABH KUMAR

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2024 12:16 PM
You are unable to dot-walk further than just the field on the table you getting the reference from.
Any further dot-walking would instead need to be done through GlideAjax and then passed back to the client.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2024 07:26 PM
Hello @HrishabhKumar
I just wanted to check back in and see how you're doing.
If I helped by answering your question please consider marking my reply as "Accept Solution".
Thanks and take care! 😀
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!