Getting value of the field instead of sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2013 08:21 AM
I have a script where I do a GlideRecord query to the request table. Once I get the records, I am getting to the value of the opned by field. But since opened by is a reference field, it is returning sys_id. How can I get the displayed value ?
Below is the script :
var gr = new GlideRecord("sc_req_item");
gr.addQuery("u_requested_for", g_form.getValue("emp_name"));
gr.addQuery("stage",'!', "waiting_for_approval");
gr.query();
if(gr.next())
{
alert("A request has already been submitted by " + gr.opened_by); // this is returming sys_id, I need the value
}
Please let me know if anyone has any suggestions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2013 12:57 PM
You can't do this with a client script the way you are attempting it. There is a response by Terri that goes over a way to get this to work as a client script.
I think we were assuming this was a server side script you were running or we'd have known .name or .getDisplayValue wouldn't work in this case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2013 09:50 AM
Hi Aaaron,
Thanks for the reply, yes I tried with the getDisplayValue(), seems to be not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2013 10:41 AM
You can try this:
var gr = new GlideRecord("sc_req_item");
gr.addQuery("u_requested_for", g_form.getValue("emp_name"));
gr.addQuery("stage",'!', "waiting_for_approval");
gr.query();
if(gr.next())
{
alert("A request has already been submitted by " + gr.opened_by.name); // this is returning sys_id, I need the value
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2018 05:23 AM
this is working for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2013 10:42 AM
try gr.opened_by.name