Change Request Risk and Impact calculation assistance needed

Mickey_Cegon
Tera Expert

We want to set up the Risk/Impact calculations so that the Risk is set by the assessment, but the Impact is a manually populated field. But, no matter what Change properties value I use to determine the method of calculating the risk/impact, it overwrites the Impact that is manually picked, with "none", when the Risk Assessment is submitted. Is there a way to calculate the Risk only, using the assessment, but leave the Impact alone? I've inactivated every Risk Condition, but it's still setting the Impact back to none. 

1 ACCEPTED SOLUTION

What are you using to do the calculations? Can you create a new script includes, copying the code from above, and comment out that impact line?

View solution in original post

3 REPLIES 3

Michael Fry1
Kilo Patron

In the Script Includes - SetChangeRisk - comment out line 36:

 

find_real_file.png

It's still doing  the calculation, and wiping out the impact. I think it's doing it based on the RiskCalculatorSNC script include, which is read-only, and it's landing on the final Else to fill in the blank impact value because I'm not using Business rule or UI action to set the risk/impact. 

var RiskCalculatorSNC = Class.create();
RiskCalculatorSNC.prototype = {

	initialize: function(changeRequestGr) {
		this.riskRecord = changeRequestGr;
		this.riskList = this.getRiskList();
	},

	calculateRisk: function() {
		if (!this.riskList.hasValue)
			return "";
		return this.riskList;
	},

	getRiskList: function() {
		var riskList = {};
		var match = false;
		var rc = new GlideRecord("risk_conditions");
		rc.addActiveQuery();
		rc.orderBy("order");
		rc.query();
		this.riskRecord.putCurrent();
		while (rc.next() && !match) {
			if (rc.use_advanced_condition)
				match = GlideRhinoHelper.evaluateAsBoolean(rc.advanced_condition);
			else {
				var filter = GlideFilter;
				match = filter.checkRecord(this.riskRecord, rc.condition);
			}

			if (match) {
				riskList.hasValue = true;
				riskList.name = rc.name + "";
				riskList.order = rc.order + 0;
				riskList.description = rc.description + "";

				if (rc.use_script_values) {
					GlideRhinoHelper.evaluateAsString(rc.script_values);
					riskList.useScriptValues = true;
					riskList.risk = this.riskRecord.risk + "";
					riskList.label = this.riskRecord.risk.getDisplayValue() + "";
					riskList.impact = this.riskRecord.impact + "";
					riskList.impactLabel = this.riskRecord.impact.getDisplayValue() + "";
				} else {
					riskList.useScriptValues = false;
					riskList.risk = rc.risk + "";
					riskList.label = rc.risk.getDisplayValue() + "";
					riskList.impact = rc.impact + "";
					riskList.impactLabel = rc.impact.getDisplayValue() + "";
				}
			}
		}
		this.riskRecord.popCurrent();
		if (!match)
			gs.addInfoMessage(gs.getMessage("No matching Risk Conditions - Risk and Impact unchanged"));		
		return riskList;
	},

	type: "RiskCalculatorSNC"
};

 

 

Mickey Cegon

 

What are you using to do the calculations? Can you create a new script includes, copying the code from above, and comment out that impact line?