G_form.getoption is not working in portal

parulmaheshwari
Kilo Contributor

Hi All,

In catalog client script if g_form.getOptions is not working in service portal but its working fine in WorkerUI.

Please suggest any alternative of these method to be used in service portal.

Many thanks in advance,

Parul

3 REPLIES 3

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi Parul,

here you will find a possible solution for doing it:

g_form.getOptions not working in the portal. alternative

However, the getOptions is NOT supported in the Service Portal, so you have to find an alternative, please try the above suggestions.

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

Any update on this?

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you

Cheers
Alberto

Jean Ferreira
Giga Guru

Hi,


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');


Reference: https://www.servicenow.com/community/developer-forum/g-form-getoptions-not-working-in-the-portal-alt...