Why can't I use "document.getElementById" in catalog item's client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 11:31 PM
error log: TypeError: Cannot read property 'getElementById' of null,I didn't check the Isolate script
- Labels:
-
Service Portal Development
- 4,035 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 11:36 PM
Hi Allen,
getElementById is blocked by ServiceNow since it may affect or break your functionality whenever upgrade happens or patch is applied.
but if you still want to use that then isolate script checkbox set it to false
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 11:55 PM
I have been set it false, but it still not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 11:36 PM
Hi in Madrid we cant use DOM. If you want to access DOM you need to make isolate check box to true
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2019 11:38 PM
Hi,
Refer to this article which suggests why you cannot use the docuemtn.getElementByID
https://hi.service-now.com/kb_view.do?sysparm_article=KB0719250