Pattern "MSSql DB On Windows Pattern" causes an error in the MID Server agent log 'org.mozilla.javascript.EcmaError: "rtrn" is not defined'

The following appears in the MID server agent log when the step is activated in the pattern. I could not get this step to execute when used with an SQLexpress server instance.

WARNING *** WARNING *** org.mozilla.javascript.EcmaError: "rtrn" is not defined. 

Caused by error in Ad hoc script 'EvalClosure-set the engine edition by the number' at line 27

The error seems to come from: "MSSql DB On Windows Pattern" in the "set the engine edition by the number" step. The area is rtrn variable which has not been initialized. 

Steps to Reproduce

Run discovery against an SQL server and check the mid server agent logs


This problem has been fixed. If you are able to upgrade, review the Fixed In or Intended Fix Version fields to determine whether any versions have a planned or permanent fix.

What is happening:
The variable "serverproperty[1].engine_num" contains a value, but not one of the choices that are presented in the various IF statements.

At the end, it tries to return 'rtrn', but without a matching choice that variable is never declared/initialized.

The solution is to declare var rtrn = ''; on line 2.


See: set_the_engine_edition_by_the_number_fixed_by_initializing_retrn_var.PNG

Related Problem: PRB1329290

Seen In

There is no data to report.

Intended Fix Version

New York

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-21 11:43:33