Client Script - getValue of field not on form

jsummers
Kilo Contributor

Trying to use the value of a field in a Client Script, but the field is not on the form (nor do I want it to be).

I'm used to using something like:

var active = g_form.getValue('active');

It works if the field is on the form (RITM in this case) but it does not recognize if the field is not on the form.

Any ideas?

4 REPLIES 4

Laurie Marlowe1
Kilo Sage

Hi Jon, If you are on a version prior to Fuji, the field has to be on the form...BUT you can hide the field with a UI Policy.   Thanks, Laurie


On Fuji. I'm seeing your suggestion and scratchpad as the two solutions. Thanks for the reply!


Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Jon,



It looks like this has been mostly answered, but I strongly recommend the g_scratchpad/display business rule solution over adding the field to the form and hiding it. The first will not really affect your form load time and is very scalable, and the second affects it by adding more data to load and loading a policy to hide the field.


Community Alums
Not applicable

Just a suggestion- can you try putting the field on the form, then using an onLoad UI Policy to hide it. Then, in the UI policy (advanced view), you can select 'Run Scripts' and put your client script in there?



I haven't tested this, I'm just spit-balling...



Cheers,



Tim