Fuji client scripts: document object is null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2015 12:39 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2015 10:08 AM
The "i" icon will hide based on the state of the system property "glide.ui.reference.readonly.clickthrough".
Customizing the Reference Icon - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2015 08:52 AM
Bobby, just wanted to let you know that I was able to set that icon as not visible by using the following statement:
g_form.getReference('access_description', function(ref) {
g_form.removeDecoration('access_description', 'icon-info');
});
I put that code in a Client Script on change of the access_description variable.
Thank you very much for your time!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2015 10:11 AM
That's great. Glad it worked out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2015 08:17 AM
it did not worked for me , is your application is a scoped application ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2015 03:42 PM
Hey srnewbie, we used the global application. The complete client script used was:
function onChange(control, oldValue, newValue, isLoading) {
if(newValue != ''){
//-- Hide the Access Description Hover Icon
if(access_description != ''){
g_form.getReference('access_description', function(ref) {
g_form.removeDecoration('access_description', 'icon-info');
});
}
}
Being "Access_description" the variable name of the onChange client script. Can you share what you are using? Have you upgraded to Fuji?