- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2016 06:39 AM
Hi everyone,
I am writing a client script in record producer to auto-fill a few user info fields based on the requester name (Your_name) entered. (The requester field is NOT a reference field)
I managed to write something below to find the requester name in user table and get the value for email, company and location :
My problem is the company and location fields in user table are reference field so they returned sys id...
I tried using gr.getDisplayValue but it doesn't seem to work in client script...
Can anyone suggest a way to get the display value for those two fields so I can auto-populate them in actual names not in sys id?
(It's returning like below now...)
Thank you!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2016 06:42 AM
I recommend doing this with an Ajax call. You need more than just the user's information in this case. Using a GlideRecord query or getReference() will work, but you'll have to make multiple calls. GlideAjax (and the corresponding server side script include) can be more surgical.
Hint: return a JSON object with sys_id and display value and use three arguments for your g_form.setValue() otherwise, you're wasting another return trip to get the display values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2016 06:41 AM
g_form.DisplayBox('YOUR REFERENCE FIELD').value;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 12:45 PM
Not sure if it changed in the last 3 years but I tried g_form.DisplayBox('YOUR REFERENCE FIELD').value; and it didnt work
It seems that its actually g_form.getDisplayBox('your reference field name').value;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2018 02:04 AM
Yes James.
g_form.DisplayBox('YOUR REFERENCE FIELD').value; used to work in the earlier versions, iof you see my reply was form 3 years back.
Thanks for sharing the new method for this. 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2016 06:42 AM
I recommend doing this with an Ajax call. You need more than just the user's information in this case. Using a GlideRecord query or getReference() will work, but you'll have to make multiple calls. GlideAjax (and the corresponding server side script include) can be more surgical.
Hint: return a JSON object with sys_id and display value and use three arguments for your g_form.setValue() otherwise, you're wasting another return trip to get the display values.