Catalog Client Script Dot Walk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2021 05:21 AM
Hello!
I have a catalog client script shown below. It aims to get the region of the location variable from the cmn_location table.
My script returns undefined when I used getDisplayValue. If I remove getDisplayValue, it returns the sys_id.
function onLoad() {
var loc = g_form.getValue('var_loc');
var gr = new GlideRecord('cmn_location');
gr.addQuery('sys_id', var_loc);
gr.query(myCallbackFunction);
function myCallbackFunction(gr) {
while (gr.next()) {
alert(gr.u_region.getDisplayValue());
}
}
}
Please help!
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2021 02:17 AM
You cannot use getDisplayValue in client side
So either use GlideAjax based approach or have 1 more query with GlideRecord
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2021 04:02 AM
Hope you are doing good.
Did my reply answer your question?
If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.
If not, please let us know if you need some more assistance.
Thanks!
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2021 01:10 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
Thanks!
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader