[TypeError: g_form.getOption is not a function] in portal

jieLian123
Tera Expert

my client script works well in platform,

but it shows [TypeError: g_form.getOption is not a function] in portal.

 

kindly refer to the 15th line of the uploaded image.

 
 
 
 
 
 
 
2 ACCEPTED SOLUTIONS

Sainath N
Mega Sage
Mega Sage

@jieLian123 : Could you please try using below.

 

var choiceValue = g_form.getValue('your_field_Name');
var choiceLabel = g_form.getDisplayValue('your_field_Name');

 

Below is the article that helps to achieve your requirement (alternative of g_form.getOption() in service portal).

 

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

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

 

View solution in original post

Narsing1
Mega Sage

Use this

var choiceLabel = g_form.getDisplayValue("<varname>");

Thanks,

Narsing

View solution in original post

3 REPLIES 3

Sainath N
Mega Sage
Mega Sage

@jieLian123 : Could you please try using below.

 

var choiceValue = g_form.getValue('your_field_Name');
var choiceLabel = g_form.getDisplayValue('your_field_Name');

 

Below is the article that helps to achieve your requirement (alternative of g_form.getOption() in service portal).

 

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

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

 

it works for me.

Thanks a lot for the help.

Narsing1
Mega Sage

Use this

var choiceLabel = g_form.getDisplayValue("<varname>");

Thanks,

Narsing