Unable to set value to a Catalog Item Variable in Service Portal

reginabautista
Kilo Sage

Hi everyone,

I am trying to set a value to a catalog item variable via Catalog Client Scripts. It is working if being loaded in native UI but when opening in Service Portal the value is not being set. I'm really baffled at this. Anyone know why? Thanks - Regina

Here's the code (onLoad):

        g_form.setValue('variables.url', 'test');

Native UI:

find_real_file.png

Service Portal:

find_real_file.png

1 ACCEPTED SOLUTION

Hmm...could you post your entire client script? Also, make sure you have UI Type marked as Both on the catalog client script record itself.


View solution in original post

10 REPLIES 10

Brad Tilton
ServiceNow Employee
ServiceNow Employee

If the name of the variable is url the code should just be: g_form.setValue('url', 'test');


reginabautista
Kilo Sage

Hi Brad i tried this too and is not working. Some were saying this is known Service Portal issue and has been addressed in Patch 6?


What type of variable are you populating? It's possible there may be a bug with a specific type.


reginabautista
Kilo Sage

I'm only using Single Line text..