New Client Scripts in London – DOM Restriction

When viewing the client script or catalog client script forms in London, you will see the following info message.

New client-scripts are run in strict mode, with direct DOM access disabled. Access to jQuery, prototype and the window object are likewise disabled. To disable this on a per-script basis, configure this form and add the “Isolate script” field. To disable this feature for all new globally-scoped client-side scripts set the system property “glide.script.block.client.globals” to false.

Any NEW client script created in the London release (existing scripts are not affected) will not run if DOM is detected. This can be worked around by setting “Isolate script” to false. You can also use the property mentioned above to disable this from checking by default globally.

The reason this is relevant is because it does a text search for DOM elements. A typical GlideAjax call will cause the script to be isolated due to things like documentElement or getElementByTagName. If these methods are detected, your script will fail.

It is recommended that the property be set to false globally.

Example case:
A client was on a ServiceNow version prior to London and performed an upgrade to the London version. There was an existing client script which contained some DOM elements which continued to function normally after the upgrade was successful. At one point, this client script was modified and afterwards, failed to work entirely. After some research, it was found that setting the “Isolate script” option to “false” corrected the problem.

Upon upgrade to London, the “Isolate script” field is set to “true” by default, even on existing scripts, but does not affect the functionality. If the script record is updated in any way, the “true” flag is then recognized and will disable the script if it contains DOM elements or methods.

Michael James

Director of Practice - AI Solutions and ServiceNow Certified Technical Architect

Mike helps clients achieve their business objectives by helping architect and develop outcome-based AI solutions using the ServiceNow platform. With the ever-growing AI offerings provided by ServiceNow, Mike is responsible for making sure clients have the appropriate solution to help modernize and revolutionize their business as well as advising on leading practices and implementations.
 
In his spare time, Mike enjoys spending time with his family and following sports, especially Penn State athletics.

Learn how Pathways Consulting Group can work for you

Connect with a ServiceNow Expert

Contact Us

Name