
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2018 08:28 AM
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.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2018 10:34 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2018 09:41 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2018 10:14 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2018 10:34 AM
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?