Retrieve choice label not the value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2016 08:34 AM
I have a glide record where I am pulling the short description, update on and stage fields. The stage field I am having a problem with, it is giving me the value, but I really need to human readable label. What is the best way to accomplish this? This is all being done in the client script section of the UI Page. Here is my script:
for(var r = 0; r < requestsRITMs.length; r++)
{
var grRITMDetails = new GlideRecord('sc_req_item');
grRITMDetails.addQuery('number', requestsRITMs[r]);
grRITMDetails.query();
while(grRITMDetails.next())
{
var description = grRITMDetails.short_descritpion;
var date = grRITMDetails.sys_updated_on;
var stage = grRITMDetails.stage; // this is where I am getting the value not the label. I want the label...
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2016 10:57 AM
If you're going to the sys_choice table for your results, you should also include table and element or you could get a lot of answers back (perhaps incorrect ones.)
You might even think to include the language (from the returned value of gs.getSession().getLanguage()) as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2021 06:49 AM
getDisplayValue() doesn't seem to be working for me on a select box populated via a client script:
//excerpt of the code populating the subtype select box
g_form.addOption('subtype', 'cc_gl', 'Cost Centre Query');
//producer.subtype.getDisplayValue() shows the variable name not the label
current.short_description = producer.query_type.getDisplayValue() + ' - ' + producer.subtype.getDisplayValue() + ' ' + producer.od.getDisplayValue();
The result is:
I was expecting "Account Query - Cost Centre Query - OD32 MENS ACCESSORIES"
Any insight would be much appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2022 10:20 AM
Did you get any solution for this Astricht? If yes, please let us know. I am facing the same issue.