- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2016 07:10 AM
Hi Everyone,
I have three tables here, one is staff duty table, another one is staff table and the other user table.
On staff duty table there is a name field reference from staff table and on staff table there is a username field reference from user table.
Now I want to use dot.walk to go from staff duty table to staff table and get the value of the username field on staff table.
Is there any code in GlideRecord that I can use?
I tried something like this but both didn't work:
gr.u_staff_name.u_username.getValue()
gr.getValue('u_staff_name.u_username')
Somehow the first one works if I replace getValue() with getDisplayValue()... But I need the actual value of that username field in staff table.
Anyone know how to do this?
Thanks!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2016 07:13 AM
Hi Kiki,
How about gr.u_staff_name.u_username
The key thing to remember is that the value of a reference field IS a sys_id. You do not need to go all the way to the sys_id field in nearly every case. So,
gr.u_staff_name.u_username.sys_id would be a waste of time.
Hope that helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2016 07:13 AM
Hi Kiki,
How about gr.u_staff_name.u_username
The key thing to remember is that the value of a reference field IS a sys_id. You do not need to go all the way to the sys_id field in nearly every case. So,
gr.u_staff_name.u_username.sys_id would be a waste of time.
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2016 08:00 AM
I knew it's that easy but just couldn't get it done properly...
Thanks so much!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2016 07:16 AM
The value of a reference field is the sys_id of the referenced record.
So to get the value of the sys_id of the user on the User [sys_user] table from the Staff duty table. You'd do the following:
gr.u_staff_name.u_username;
Here's how it would look, you can fill in the field names for the below dot walking structure:
[staffduty GlideRecord object].[reference field of staff table].[reference field of sys_user];
If that doesn't work perfectly, stick a ".sys_id" at the end of it like so:
[staffduty GlideRecord object].[reference field of staff table].[reference field of sys_user].sys_id;
Can you post your entire query?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2016 07:59 AM
Problem solved! Thanks so much!