
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2017 07:55 AM
I have a string field on a form that has a choice list.
It's the "Label" of the choice list that I want:
If I do g_form.getLabelOf('u_computer_type'), of course it will return: Computer Type
What trickery can I do to get the label of the chosen choice?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2017 07:58 AM
4.8.10 Get the label for a choice list value
var choiceValue = g_form.getValue(<fieldName>);
var choiceLabel = g_form.getOption(<fieldName>, choiceValue).text;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2017 07:58 AM
4.8.10 Get the label for a choice list value
var choiceValue = g_form.getValue(<fieldName>);
var choiceLabel = g_form.getOption(<fieldName>, choiceValue).text;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2018 09:29 AM
Great, very useful.
Unfortunately, g_form.getOption() doesn't work with Service Portal ( for now ...)
There is a topic with @Chuck and @Brad about it here : g_form.getOptions not working in the portal. alternative

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2017 08:05 AM
Freaking genius. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2021 09:51 AM
var choiceValue = g_form.getValue(<fieldName>);
var choiceLabel = g_form.getOption(<fieldName>, choiceValue).text;
is no longer working in the current Service Portal, you can use this instead;
var valueLabel = g_form.getDisplayValue(<fieldName>);