g_form.getOptions not working in the portal. alternative

lomouhamadou
Kilo Guru

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

8 REPLIES 8

Chuck Tomasi
Tera Patron

Use an $http request to do a REST call in your widget to get the options from the sys_choice table.


Brad Tilton
ServiceNow Employee
ServiceNow Employee

I'm assuming you're using a catalog client script on a catalog item or record producer here. I believe that Service Portal only supports methods that are mobile friendly in client scripts, so you might have to use either getReference() with a callback or a GlideAjax call here. What exactly do you need the display value for here, maybe there's another way you can go about accomplishing your requeirement.


Hi Brad,



It is on record producer on HR case table.


The thing is after user completed the whole form, I generate a PDF already filled in with the value that user just added.


I have some fields that are select boxes and getvalue return 1 or 2 or 3 etc...; but I need to get the related text and put it in the pdf.


So you're running an onSubmit client script that generates the PDF? In that case I think you might end up needing another step. Maybe from your record producer script you could redirect the user to a ui page where you pass the display values of all of those fields from the server side RP processing script and generate the pdf from there.