g_form.getOptions not working in the portal. alternative
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2016 05:09 AM
Hi all,
With the new service portal g_form.getOptions is not working and using g_form.getValue will return the value and not the display value which is a string.
GetOption is not handle by the portal
Has anyone an idea or alterntive?
Regs,
Lô Mouhamadou

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2018 09:45 AM
Hi,
@Brad @Chuck,
what about using g_form.getDisplayValue() to get choice Label in current user Language instead of g_form.getOption() since it's not working on Service Portal ( for now...) ?
from the Old wiki :
var choiceValue = g_form.getValue('category');
var choiceLabel = g_form.getOption('category', choiceValue).text;
turn into
var choiceValue = g_form.getValue('your_field_Name');
var choiceLabel = g_form.getDisplayValue('your_field_Name');
It's working with Service Portal on Desktop, but is it a good practice to use here, or we could have some issue ? what about Mobile.
Regards,
Denis.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2018 09:57 AM
I answer to myself : some methods are deprecated and could stop to work in future versions :
More from Docs here :
Mobile client GlideForm (g form) scripting and migration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2021 09:46 AM
This works for me!. Thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 07:29 PM
I am trying to set an item in a record producer variable with Multiple Choide and get the Text of the Multiple Choide on OnSubmit in the catalog client script.
var choiceValue = g_form.getValue('your_field_Name');
var choiceLabel = g_form.getDisplayValue('your_field_Name');
In either of the above methods, the Value is retrieved, not the Text.
In the case of a Select Box item, not Multiple Choide, the Text is successfully obtained by getDisplayValue().
Also, in the case of OnChange, not OnSubmit, the Text is successfully obtained by getDisplayValue() even in the case of Multiple Choide.
Is there any way to get the Text of Multiple Choide when OnSubmit?
Thank you in advance.