Computed score not getting populated for inherent assessment in risk assessment methodology.

jigyasaarora23
Tera Contributor

As per requirement, I have created a Risk assessment methodology with all four assessments Inherent, control, residual, and target. Here residual and target are using same factors as that of inherent assessment. Now, since given matrix (PFA image) cannot be fulfilled using any existing qualitative scoring logic, so I used the following script to calculate the score. The issue I am facing is that in workspace while testing an assessment the computed score for inherent and residual is not showing up. Whereas the same factors and script being used for target and for that computed score is getting populated.
Please find below the screenshot and script for reference.
/*************************************************************************************/

/* 1. Use the predefined variables from the Qualitative script variables field.
/* 2. You can define your own script variables within the script itself. For example, var impact = 1;
/* Example 1: If you wish to write a formula such as (FACxxxxxxx1 * FACxxxxxx2)/FACxxxxxx3 between three factors, FACxxxxxx1, FACxxxxxx2 and FACxxxxxx3 which represent impact factor, likelihood factor and speed of onset factor respectively, then write the the code: score = (FACxxxxxxx1 * FACxxxxxx2)/FACxxxxxx3
/* Example 2: If you wish to use your own variable in the script you can write it as 'score = (FACxxxxxxx1 * FACxxxxxx2 + cust_var)/FACxxxxxx3' where cust_var is your declared variable.

/*************************************************************************************/



try {

/***Start of Custom Code. Please write your scoring formula below. */
score = '';
var a = JSON.parse(gs.getProperty('sn_risk_advanced.inherent_business_risk_matrix_1'));
for (i = 0; i < a.length; i++) {
if (a[i].likelihood == Math.round(FAC0001079) && a[i].consequence == Math.round(FAC0001081)) {
score = a[i].score;
break;
}
}
//result.score = parseInt(score);
score = parseInt(score);
/***End of Custom Code. Do not modify anything below. */

if (isNaN(score)) {
throw 'Not a number';
} else if (score == Infinity) {
throw 'Divide by zero error';
}
} catch (ex) {
result.error = ex;
}

3 REPLIES 3

satya6
ServiceNow Employee
ServiceNow Employee

Can you check if it is just happening during this script scenario or it is always happening that computed score is not getting updated. Like create a RAM which is just based on some scoring logic instead of script and check if those computed fields are populated.

Hi @satya6 ,

So I updated the qualitative scoring logic to Product instead of Script and still computed inherent risk is not getting populated. 

FYI : we are using  18.0.0 version for Risk management in our instance.

jaikishan1
ServiceNow Employee
ServiceNow Employee

Hi @jigyasaarora23 ,
We have not observed any issue with populating the calculated field.
Can you please confirm the score is not getting updated even after saving the record and moving it to next state i.e. control statement. Also, please ensure that the assessment methodology and its factors are in published state after making the changes.

Can you please provide more screenshots describing your setup with scoring logic selected to product ?This will help us analyze the issue better.

Please mark this as helpful if it solves your query.

Regards,
Jai