Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Javascript Strict Mode

Robin Hearne
Tera Expert

It seems that scripts in my Production instance are run in 'Strict Mode' but those run in my sub-production instances do not.  The reason for this assessment is that I've experienced a couple of issues where a Workflow script activity worked fine during testing but threw a 'Assignment to undefined xxxx in strict mode' error when promoted to the Production instance.

I need to make sure that all instances are configured the same for obvious reasons.  What setting(s) do I need to review that would cause Strict Mode to be enabled?

Thanks in advance.

Robin

2 REPLIES 2

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Robin,

 

To Enable this on a per-script basis, configure this form and add the "Isolate script" field and Enable this field whereas To disable this on a per-script basis, configure this form and add the "Isolate script" field and disable this field. More info here

 

-Pradeep Sharma

Robin Hearne
Tera Expert

Hi Pradeep.

Thanks for your reply.  The issue that I'm trying to address is that the same script is working fine in my sub-production instances but throws a Strict Mode error in my Production instance due to an non-declared variable.  I need to get all instances behaving the same so that I discover this type of error before promoting the scripts to production.

Regards,

Robin