strict mode and sharing code between client scripts - how to turn it off for the form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2018 04:06 PM
Hi Guys,
I have some common code that need to share between couple of client scripts (onChange event). I have created a client script (onLoad) and copied the common code for reuse. But when I use it, I get the error that it can't find the common function. I am thinking its because of the following infomration at the top of the form:
"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. "
If this is the case how can I disable "Isolate script" only for this form? - Not gobally through system settings. In particular I want to know what this means "configure this form and add the "Isolate script" field."
Stepwise please.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2018 01:22 AM
> Configure this form and add "Isolate Script" field
This means to configure the catalog client script form to show the field "Isolate script".
You cannot disable this on a "per form" basis but rather a "per script" or "for all globally scoped client-side scropts"
Read more about it here: https://hi.service-now.com/kb_view.do?sysparm_article=KB0694479
/*
-- To disable this on a per-script basis, configure
this form and add the "Isolate script" field and
disable this field.
-- To disable this feature for all new globally-scoped
client-side scripts set the system property
"glide.script.block.client.globals" to false. If
you cannot find this property in your 'System
Properties > All Properties' [sys_properties] table,
add as follows:
1. Go to sys_properties
2. Click New
3. Populate the form
Name: glide.script.block.client.globals
Type: true|false
Value: false
*/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2020 06:50 AM
Hi,
I am getting same error.
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.
I am using ServiceNow New York version. I added property and uncheck "Isolate script" field value. but still client script is not working. please suggest me solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2023 12:21 AM
I know this is old, but what I do is on an onLoad I define a function and allocate it to scratchpad. Like:
g_scratchpad.myFunctionName = function (inputVar) {
*put your code here*
};
Then on any other script included, you should be able to use it like g_scratchpad.myFunctionName(inputVar);