ITOM Pattern Scoped Pre Execution Scripts are not calling the global namespace causing "SNC is not defined" JavaScript Exception


Description

1. ITOM Pattern Scoped Pre execution Scripts are calling SNC.PrePatternExecutionData instead of global.PrePatternExecution to get the Pre Pattern Execution data which causes a "variable is not defined" JavaScript exception in below example. 

org.mozilla.javascript.EcmaError: "SNC" is not defined.
Caused by error in script at line 8

5: * below is an example of the possible variables that can be added.
6: */
7:
==> 8: var data = new SNC.PrePatternExecutionData();
9:
10: data.addString('shouldIncludeDomain',gs.getProperty('glide.discovery.hostname.include_domain', 'false'));
11: data.addString('hostnameCase',gs.getProperty('glide.discovery.hostname.case', 'No change'))

 

2. Affected Pre/Post Scripts

 

Cause

This looks like a regression from PRB1288983 that was raised back in the London release and has been fixed since Istanbul. Root Cause is still under investigation by ServiceNow Support and Dev teams.

 

Resolution

These Pre Execution Scripts should be calling "var data = new global.PrePatternExecution();" as are the other Pre execution scripts in the Discovery and Service Mapping application.

1. Open a record for one of the four affected Pre Execution Scripts.

2. Find the line "var data = new SNC.PrePatternExecutionData();" near the beginning of the Script (Note the exact line number will vary in each script)

3. Make the below change to the line.

Old value:
"var data = new SNC.PrePatternExecutionData();"

New Value:
"var data = new global.PrePatternExecution(); "

4. Save the Pre Execution Script

5. Repeat the procedure in Steps 1 through 4 for each of the Pre Execution Scripts.