Notifications

1092 views

Description

If you are using the original Change Management - Risk Assessment [Legacy] plugin (com.snc.change.risk_assessment)

You will get the following error in the logs when you Execute Risk Calculation

Evaluator: org.mozilla.javascript.EcmaError: Cannot set property "updated" of undefined to "true" Caused by error in sys_script_include.925c80320a0a2c7669afdc12628f5a12

 

If you are using the new Change Management - Risk Assessment plugin (com.snc.change_management.risk_assessment)

When Change Management Risk Assessment is activated and matches a Change, but no Risk Conditions matches, Risk is not evaluated. Instead the customer gets an information message telling them that:

No matching Risk Conditions - Risk and Impact unchanged

Also, the logs will contain the following:

2019-03-14 11:35:19 (351) Default-thread-3 66D68937B70033000999E4F6EE11A90F txid=34274d37b700 WARNING *** WARNING *** Evaluator: org.mozilla.javascript.EcmaError: Cannot set property "risk" of undefined to "undefined"
Caused by error in sys_script_include.c4dfd08ed7033200532c24837e6103d8.script at line 483
2019-03-14 11:35:19 (351) Default-thread-3 66D68937B70033000999E4F6EE11A90F txid=34274d37b700 WARNING *** WARNING *** Evaluator: org.mozilla.javascript.EcmaError: Cannot set property "risk" of undefined to "undefined"
Caused by error in sys_script_include.c4dfd08ed7033200532c24837e6103d8.script at line 572
2019-03-14 11:35:19 (352) Default-thread-3 66D68937B70033000999E4F6EE11A90F txid=34274d37b700 WARNING *** WARNING *** Evaluator: org.mozilla.javascript.EcmaError: Cannot set property "risk" of undefined to "undefined"
Caused by error in sys_script_include.c4dfd08ed7033200532c24837e6103d8.script at line 539
2019-03-14 11:35:19 (352) Default-thread-3 66D68937B70033000999E4F6EE11A90F txid=34274d37b700 WARNING *** WARNING *** Evaluator: org.mozilla.javascript.EcmaError: Cannot set property "risk" of undefined to "undefined"
Caused by error in sys_script_include.c4dfd08ed7033200532c24837e6103d8.script at line 535
2019-03-14 11:35:19 (352) Default-thread-3 66D68937B70033000999E4F6EE11A90F txid=34274d37b700 WARNING *** WARNING *** Evaluator: org.mozilla.javascript.EcmaError: Cannot set property "risk" of undefined to "undefined"
Caused by error in sys_script_include.c4dfd08ed7033200532c24837e6103d8.script at line 373
2019-03-14 11:35:19 (353) Default-thread-3 66D68937B70033000999E4F6EE11A90F txid=34274d37b700 WARNING *** WARNING *** Evaluator: org.mozilla.javascript.EcmaError: Cannot set property "risk" of undefined to "undefined"
Caused by error in Phase 2 Jelly: ftp://gsft_database_form/sys_ui_page.bb4c6966d7033200532c24837e6103ae.html.2 at line 3

1: var changeRequestSysId = (jelly.sysparm_id) ? jelly.sysparm_id : "";
2: if (changeRequestSysId)
==> 3: new ChangeRiskAsmt().processRiskAsmt(changeRequestSysId);
4: else
5: gs.logError("URL params: sysparm_id or sysparm_asmtInstanceSysId are missing", "UI Page: change_risk_asmt_close_dialog");

Steps to Reproduce

If you are using the original Change Management - Risk Assessment [Legacy] plugin (com.snc.change.risk_assessment)

  1. Madrid instance with Change Management - Risk Assessment [Legacy] plugin and demo data installed (this is now development so you need maint if not already installed).
  2. Set all Risk Conditions to be inactive
  3. Create a new change request with category Hardware and risk set to High
  4. Fill out Risk Assessment, set the last option for every question and submit 

If you are using the new Change Management - Risk Assessment plugin (com.snc.change_management.risk_assessment)

  1. Install the Change Management Risk Assessment plugin.
  2. Deactivated all Risk Conditions
  3. Go to any Change Request that matches a Risk Assessment

Expected behavior: Change Request to calculate risk

Actual behavior: Info Message No matching Risk Conditions - Risk and Impact unchanged

Workaround

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.

If you are not able to upgrade, perhaps you can use the following workaround.

If you are using the original Change Management - Risk Assessment [Legacy] plugin (com.snc.change.risk_assessment)

Modify script include: RiskAssessmentCalculator by moving the following line ~107:

evaluatedRiskImpact.riskEvaluation.risk = evaluatedRiskImpact.riskAssessment.risk;

To before the "Evaluate Risk Conditions" comment ~line 67:

// Evaluate Risk Conditions - impact set, highest risk set based on Assessment vs Conditions

If you are using the new Change Management - Risk Assessment plugin (com.snc.change_management.risk_assessment)

Modify script include: ChangeRiskAsmt adding the following method:

	calculateRisk: function(changeRequestGr) {
		var evaluatedRiskImpact = {};
		changeRequestGr = changeRequestGr || this.changeRequestGr;

		if (!changeRequestGr) {
			evaluatedRiskImpact.errorMsg = gs.getMessage("No valid Change Request record provided");
			return evaluatedRiskImpact;
		}

		var riskAssessment;
		if (this.hasAssessment(changeRequestGr) && this.hasCompletedAssessment(changeRequestGr)) {
			riskAssessment = this._calculateAsmtRisk(changeRequestGr);

			if (this._log.atLevel(global.GSLog.DEBUG))
				this._log.debug("[calculateRisk] riskAssessment: " + JSON.stringify(riskAssessment));
		}

		evaluatedRiskImpact = new RiskCalculator(changeRequestGr).calculateRiskConditions();
		if (!evaluatedRiskImpact.riskEvaluation)
			evaluatedRiskImpact.riskEvaluation = {};

		if (riskAssessment)
			evaluatedRiskImpact.riskAssessment = riskAssessment;

		if (evaluatedRiskImpact.riskCondition) {
			if (this._log.atLevel(global.GSLog.DEBUG))
				this._log.debug("[calculateRisk] evaluatedRiskImpact.riskCondition: " + JSON.stringify(evaluatedRiskImpact.riskCondition));

			if (evaluatedRiskImpact.riskCondition.risk)
				evaluatedRiskImpact.riskEvaluation.risk = evaluatedRiskImpact.riskCondition.risk;

			if (evaluatedRiskImpact.riskCondition.impact)
				evaluatedRiskImpact.riskEvaluation.impact = evaluatedRiskImpact.riskCondition.impact;
		}

		// Highest risk wins (actually lowest value, High=2, Moderate=3, Low=4)
		if (evaluatedRiskImpact.riskAssessment && evaluatedRiskImpact.riskAssessment.risk && evaluatedRiskImpact.riskAssessment.risk.value &&
				((!evaluatedRiskImpact.riskCondition || !evaluatedRiskImpact.riskCondition.risk) ||
					parseInt(evaluatedRiskImpact.riskAssessment.risk.value) < parseInt(evaluatedRiskImpact.riskCondition.risk.value)))
			evaluatedRiskImpact.riskEvaluation.risk = evaluatedRiskImpact.riskAssessment.risk;

		if (evaluatedRiskImpact.riskAssessment && evaluatedRiskImpact.riskAssessment.msg)
			gs.addInfoMessage(evaluatedRiskImpact.riskAssessment.msg);

		if (evaluatedRiskImpact.riskCondition && evaluatedRiskImpact.riskCondition.msg)
			gs.addInfoMessage(evaluatedRiskImpact.riskCondition.msg);

		evaluatedRiskImpact.riskEvaluation.risk.updated = parseInt(evaluatedRiskImpact.riskEvaluation.risk.value) !== parseInt(changeRequestGr.risk + "");

		if (evaluatedRiskImpact.riskEvaluation.risk.updated) {
			evaluatedRiskImpact.riskEvaluation.risk.updatedMsg = gs.getMessage("Risk set to: {0}{1}{2}", [new RiskCalculator().getStartColorTag(), evaluatedRiskImpact.riskEvaluation.risk.display_value, new RiskCalculator().getEndColorTag()]);
			gs.addInfoMessage(evaluatedRiskImpact.riskEvaluation.risk.updatedMsg);
		}

		// Populate legacy values (as customers may have called and expect JSON legacy values)
		evaluatedRiskImpact.risk = evaluatedRiskImpact.riskEvaluation.risk.value;
		evaluatedRiskImpact.riskUpdated = evaluatedRiskImpact.riskEvaluation.risk.updated;
		evaluatedRiskImpact.impact = evaluatedRiskImpact.riskEvaluation.impact.value;
		evaluatedRiskImpact.impactUpdated = evaluatedRiskImpact.riskEvaluation.impact.updated;

		if (this._log.atLevel(global.GSLog.DEBUG))
			this._log.debug("[calculateRisk] evaluatedRiskImpact: " + JSON.stringify(evaluatedRiskImpact));

		return evaluatedRiskImpact;
	}

Related Problem: PRB1331270

Seen In

There is no data to report.

Intended Fix Version

New York

Fixed In

Madrid Patch 3

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-07-01 07:58:36
Published:2019-04-16