How do I get assessment script to include value in calculation?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 10:06 AM
I have a risk assessment metric where I am trying to use a script to automatically determine the value based on CMDB data. The rest of the risk assessment is in a UI pop-up as questions/choices found on the Change Request form. The risk assessment metrics are all included under the same risk assessment that is being called in the UI pop-up from Change Request. I cannot get the script to populate a value and have the value added to the total risk value calculated from the questions and answers from the UI pop-up. This causes my assessment threshold limits for the risk assessment to be out of sync.
I have configured my metric in the following way:
The script is:
var changeTasks = new GlideRecord('task_ci');
changeTasks.addQuery('task', primary);
changeTasks.query();
var cis = [];
var locations = [];
var sla = [];
while (changeTasks.next()) {
if(!changeTasks.ci_item.location.u_sla_site_tier.nil()) {
cis.push(parseInt(changeTasks.ci_item.location.u_sla_site_tier.getValue()));
}
}
var actual_result = Math.max(cis);
gs.info("assessment actual_result is: " + actual_result);
if (actual_result === 1)
scaled_result = 6;
else if (actual_result === 2)
scaled_result = 4;
else
scaled_result = 2;
gs.info("assessment scaled_result is: " + scaled_result);
Please let me know if I am missing a step in here. Does there need to be a risk condition added in order to include this script in the final calculation of risk? Or should this script value be included automatically in the total risk calculated once the UI pop-up risk assessment has been completed?
Thanks!
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 10:24 AM
Hi,
Your scaled value will be used for risk calculation at then end of assessment i.e. once you complete the assessment.
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2019 11:18 AM
When I look at the asmt_assessment_instance the metric is not included. The way I test the risk threshold would be upgraded if the metric was included. How can I definitively determine if it is being calculated?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 12:33 PM
Your logging should tell you if your script is running and returning the correct scaled result. I would double check the weight on your metric. A weight of 1 means that the scaled result is 1% of the final calculation for that section of the assessment. If this is meant to count more toward the final result, than you need to change the weight.