g_form.setValue('box',true); doesn't work on service portal

sonita
Giga Guru

This code is perfectly fine on Try it , but doesn't work on service portal

variable 'box' is a checkbox 

 

g_form.setValue('box',true);   doesn't work on service portal 

 

I even selected UI type to be 'All' ; but still doesn't work on portal.

1 ACCEPTED SOLUTION

Rakhesh
Kilo Guru

Hi Sonita,

 

I'm getting the result. I'm using the UI policy. follow the below screenshots it works.

 

find_real_file.png

use runscripts in ui policy.

 

 

find_real_file.png

View solution in original post

10 REPLIES 10

Even onchange client script also working for me.

 

use 

g_form.setValue('box','true');

Tyler Hoge - Gl
Tera Guru

Try using true as a string like 'true' like Rakhy suggests. Servicenow sometime struggles with true/false being a string and not a boolean value.

You're absolutely  right. Unfortunately I can't mark two answers as correct answer.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Sonita,

Any update on this?
Can you mark answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

g_from.setValue('box','true'); ---> it works as expected