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 08:30 AM
alert("A request has already been submitted by " + gr.opened_by.getDisplayValue());
Can you try that?
- 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:40 AM
Hi Ravali,
Sorry you're still have trouble getting this to work. I just went to one of the demo labs and ran this as a background script.
var gr = new GlideRecord("sc_req_item");
gr.query();
if(gr.next())
{
gs.log(gr.opened_by.getDisplayValue());
}
This is getting the display name of the user back. Are you trying to use this in a business rule or a client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2013 12:40 PM
I am trying to do this in the client script.. I know I have had this working previously in the past, not sure why it is not working..