Fuji client scripts: document object is null

aklimenko
Mega Expert

Hi

We use document.getElementById() or gel() in client scripts to get controls. In some places we cannot replace it with g_form. For example, I need to get a catalog item sys_id in variable set client script so the only way I could do that was document.getElementById("sysparm_id").value

What I found out is that for any client script document object is null:

[Error] TypeError: null is not an object (evaluating 'document.getElementById')

Any ideas?

42 REPLIES 42

pavan_poul
Kilo Expert

Hi Alexey,



In Scoped app(fuji), we are not supporting for DOM Object   ( document.getElementById() ).


Dom manipulation is strictly restricted in fuji.



Thanks,


Pavan


Ok, so please advise how to get in a variable set client script catalog item sys_id?


Hi Alexey,


Could you please try with this once.


var incSysid = g_form.getUniqueValue();



Thanks,


Pavan


TypeError: undefined is not a function (evaluating 'g_form.getUniqueValue()')


Also g_form.setValue functions no longer work on Fuji for catalog client script from variable set -   same error


Checked on   Eureka:


- g_form.getUniqueValue doesn't work - returns empty


- g_form.setValue works fine


The script is onLoad attached to variable set that is attached to a catalog item.


This blocks all our use cases with service catalog