Weird onLoad client script behavior.

adityabilgu
ServiceNow Employee
ServiceNow Employee

The objective was to set a field as readOnly when the form loads.

The line 11 g_form method did not work. I tried a few different things and the same line, works if we give it a timeout. why is that so? (PFA image)
(the unequal_split is a simple_name_value dictionary type)

 

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

I have run into this when trying to manipulate a MRVS onLoad as the MRVS loads after the form - could be the same with this field type - g_form is trying to make it read only before it's visible/loaded on the form.  Have you tried using a UI Policy instead?

Yup, UI policy works. And yes, The client script is trying to execute before the form fields fully load.