GlideRecord get label of reference field instead of sys_id

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2016 12:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 03:08 AM
Hi Rober, I have tried your suggestion but I think it doesn't work on gliderecord.
Also this is in a catalog item.
Thanks,
Tadz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 03:25 AM
Cris,
You need to use value and display value.
You can refer this example:
GlideForm (g form) - ServiceNow Wiki
In your case it will be:
g_form.addOption('u_topic', value of topic, label of topic);
PS: Hit like, Helpful or Correct depending on the impact of the response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 04:28 AM
Hi Mishra,
I'm trying to make the options dynamic, thats why i use gliderecord.
My problem is I can't get the label of the topic. It only fetch the sys_id value of it since it is referenced
Thanks,
Tadz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 04:40 AM
Hi Thadeo,
You have to use GLide Ajax, Here is a sample that I have developed to get the work notes value (I dont have the same field than you and you can use it as your requierement, Dont forget to change the value of the field) .
TO achieve this, you have to first create a script include :
Script include :
name : worknotesMandatory
Client Callable : true
Script :
var worknotesMandatory = Class.create();
worknotesMandatory.prototype = Object.extendsObject(AbstractAjaxProcessor, {
worknotes: function() {
var worknotes = this.getParameter('sysparm_current_worknotes');
if (worknotes == '') {
return this.getParameter('sysparm_current_worknotes');
}
}
});
One note : in your case here, you can copy and paste you glideRecord. And you can return gr.fieldName.getDisplayValue() to get display Value of the field (examle : gr.u_topic.getDisplayValue())
Then a client script which will call the script include above :
function onLoad() {
//Type appropriate comment here, and begin script below
makeWkMandatory();
}
That is all,
Let me know if you need more helps, I believe that will help to clear your issue:
Kind regards,
ZA
Do not feel shy to mark correct or helpful answer if it helps or is correct

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 06:07 PM
Hi Zic,
Right now, Im working on it.
Will tell you later if I have issues or it works.
Thanks
Tadz