Risk Assessment
Overview
As part of IT Changes it is often a requirement to calculate risk based on a questionnaire. To allow for this, Servicely provides the ability to create multiple risk assessments to allow you to create a set of questions, with specific weightings based on your requirements. To allow for this, it leverages a similar tool set to the Catalog Item functionality, ensuring that similar concepts / knowledge can be carried over to calculate risk.
How to create a Risk Assessment
To create a Risk Assessment you will need to start off by going to “Risk assessment items” table. We provide an example out of box (which you can make inactive), but you can use this as inspiration to create your own. Creating questions and answers are largely the same as creating a Catalog Item (which you can see more information here Catalog item ), with a few differences and requirements. Noting that this will not show up in the catalog and will be triggered / run another way.
You will want to make sure the Key is something that makes sense from a script perspective, as it will be used to show the Risk Assessment via a button.
You will want to ensure the table is “Risk assessment answers”.
In the record generation script (in the advanced tab), you will want to include something very similar to the following (which you can copy from the out of box risk assessment example).
// Variables are current, sourceRecord, questions
let sourceRecordId = sourceRecord.ID();
let sourceRecordTableName = sourceRecord.TableClass();
let genericReferenceId = sourceRecordId + ":" + sourceRecordTableName;
let questionsAndAnswers = questions.asJson();
// Calculate the risk
let risk = RiskAssessmentUtil.calculateRisk("Change risk assessment", questionsAndAnswers);
// Put on the source record.
Table(sourceRecordTableName, sourceRecordId).Risk(risk).update();
// Put on the RiskAssessmentAnswers record, this will be automaticlly updated.
current.Record(genericReferenceId);
current.Risk(risk);
Once you have created the Risk assessment item and its questions, you will want to flag it as such, which you can do via the “Change risk assessments” menu item, which allows you to give it a name and provide any notes about it.
At this point you will have the questions and records being generated from a “visible” perspective, however, to allow you to calculate risk from it, there are more records that need to be generated to allow for it to do what you require.
Thresholds and Weighting
To allow risk assessments to calculate risk in a useful method, Servicely allows you to set different weighting to different questions / answers to provide you the most accurate look on your risk. What this means is that different questions may have a different weighting against a overall score, with every answers having a different score against it. Such as if you have 2 questions, this will come up to a different score based on the score / weighting. An example is as per below.
Has this changed happened before? (Weighting: 5)
Yes (Score:1)
No (Score:5)
How long does it take to back out? (Weighting: 2)
Instantly (Score:1)
Less than 1 hour (Score:3)
More than 1 hour (Score:5)
If I pick the following answers, I would get the following scores (Examples below)
1A and 2B: 1x5 + 3*2 = 11
3B and 2A: 5*5 + 5*2 = 35
1A and 2A: 1*5 + 1*2 = 7
With these total scores then, this will then look at the thresholds to understand the risk. An example is where we might say the following thresholds for each risk level:
Low: 0
Medium: 10
High: 20
Critical: 30
In the above example, it would then be: Medium, Critical and Low risk respectively. As 11 is more than 10, but less than 20, 35 is above 35, and 7 is less than 10. To set these up, there are a few related records to deal with this.
To accomplish this there are a few different records you need to create to make this possible.
Risk assessment questions
The risk assessment questions table allows you define the question’s weighting. From a basic level, you simply need to relate a question and risk assessment together, as well as giving it a name and weighting (more than 0). This will seem similar to the step of creating the questions initially, but this is just to tie things together in the background to ensure a weighting can be given against a question.
Risk assessment question answers
This is the table that allows you to record the score of a specific answer sometime selects. These answers need to match the answers on the question itself. Such as for the choice questions, it needs to be the choice key, for booleans, “yes” and “no”.
Risk assessment thresholds
This table holds the thresholds for the risk assessment to determine the level of risk. The risk needs to be the same values as the risk on the change. The threshold is the lowest total score for a record to meet that risk. Presently you can only have one set of thresholds that are used for all assessments, so plan your scores and weighting accordingly.
Triggers and usage
To trigger a risk assessment, you can do so via a client side script. Out the box, we provide a table operation called “Change - risk assessment” which can be disabled in case you want to make your own version. The important element of this (which is why it can be used in other client side scripts) is an on before script. This is where you can define what risk assessment should be called (and you can make use of other APIs or fields in the system to do what you require). We have highlighted below with a comment (line 27) which property should be updated, to match the risk assessment key defined earlier.
// We need to find the risk assessment record we created last time we ran this so that we can find the answers.
let q = Table("RiskAssessmentAnswers").EQUAL("Record", id + ":" + tableName).query();
let recordId = q.hasNext() ? q.next().ID() : null;
return new Promise((resolve, reject) => {
// Context contains the id of the generated RiskAssessmentAnswers record
let closeCallback = (closeReason, context) => {
resolve(true);
};
let questionItemParams = {
recordId: recordId,
recordTable: null,
sourceRec: {
TableClass: tableName,
id: id
},
sourceIsNewRecord: current.isNewRecord()
};
let modalOptions = {
showCloseIcon: true,
showCloseButton: false,
closeCallback: closeCallback,
title: "Risk assessment"
};
Navigate.showQuestionModal({
questionItem: 'RiskAssessment', // <-- This is where you can define a different Risk assessment
questionItemParams: questionItemParams,
modalOptions: modalOptions
});
});
Servicely Documentation