32 views

Description

Change risk assessment is using a sum of actual values, but should use a sum of actual values multiplied by each question's weight. This is because Survey & Assessment V2 does not offer that same formula for calculation as Survey & Assessment V1. Once Survey & Assessment V2 provides this formula, the work around will not be necessary and should be backed out.

Steps to Reproduce

Change the value of the weight of some of the questions in a Change Risk Assessment, to something higher than 1. Note that demo data ships all weight values as: 1

Complete a Risk Assessment and note that the calculated value is a sum of the actual values, rather that a sum of actual values multiplied by question weight.

Workaround

 
sys_script_include: ChangeRiskAsmtSNC sys_id: c4dfd08ed7033200532c24837e6103d8 has a function that should calculate the weighted composite score, but instead calculates the a sum of the actual values. To have the same behaviour as the Legacy Change Management Risk Assessment the following function should be overridden in sys_script_include: ChangeRiskAsmt sys_id:  884c5254d7233200532c24837e61032c. Or simply import the attached script include. Once 
 
calcAsmtScore: function(asmtInstanceId) {

    var score = 0;

    var gr = new GlideRecord(this.ASMT_METRIC_RESULT);

    gr.addActiveQuery();

    gr.addAggregate("SUM", "actual_value");

    gr.addQuery(this.INSTANCE, asmtInstanceId);

    gr.addNotNullQuery("actual_value");

    gr.groupBy(this.INSTANCE);

    gr.query();

    while (gr.next())

        score += gr.actual_value * gr.metric.weight;

 

    if (this._log.atLevel(global.GSLog.DEBUG))

        this._log.debug("[calcAsmtScore] score: " + score);

 

    return score;

},


Related Problem: PRB1294688

Seen In

There is no data to report.

Intended Fix Version

Madrid

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:2018-08-24 13:12:16
Published:2018-08-14