Difference between g_form.getUniqueValue(); and gel('sys_uniqueValue').value;

Attila Beregvar
Tera Guru

Dear Community,

Please help me to understand what is the difference between gel('sys_uniqueValue').value; and g_form.getUniqueValue();

I have an OOTB UI action (client side) in my personal developer instance on a related list of a form, where the script was fully untouched, but it stopped working for some reason - nothin happens if I click on it.

In the ootb script, this line is used: var sysId = gel('sys_uniqueValue').value;

I managed to debug, that if I change this line to: var sysId = g_form.getUniqueValue(); it works again.

So what is the technical difference between the 2, and why could it be that the first version stopped working?

Thanks!

1 ACCEPTED SOLUTION

Jorn van Beek
Tera Guru

gel is short for document.getElementById maining this is default javascript.

The g_form.getUniqueValue() is a ServiceNow function.

By default gel is no longer prossible for new client scripts since manipulation of the document is no longer allowed (can switch it on, on a per script basis).

find_real_file.png

View solution in original post

6 REPLIES 6

Hello Saurav,

 

You are absolutely right, the Isolate Script option also works.

However my problem is that this is not custom UI action I want to write, this is an OOTB UI action, written by ServiceNow, which is not working due to the usage of "gel" (on this OOTB UI action, the Isolate Script attribute is TRUE).

 

Thanks for the info tho!

Yes because the isolate script is true that is why it is not working.

If my answer helped you please mark i as correct as well.

Thanks.