Risk assessment plugin

Bhavani6
Kilo Explorer

Hi,

We are trying to use the risk assessment plugin for the calculation of risk. While I fill the risk questions in the plugin and click on 'submit' button , my risk should be calculated. We do not want to click on the 'execute risk calculation' related link to calculate the risk.

Could anybody help me on knowing the functionality of the 'Execute risk calculation' and bring both the functions 'Fill Out Risk Assessment' and 'Execute Risk Assessment' in one?

3 REPLIES 3

sherman_1206
Tera Contributor

I ran into similar issues and in fact we were requested to have risk calculate on the fly while user fills out form. Therefore, I wrote client scripts to do our risk assessment instead of the risk calculator.

We did not like that user had to submit for risk to be calculated. Interested in hearing how this can be done though, I suspect you could make a UI action which triggers the Risk assessment. (I just never found motivation to do it since our requirements changed.)


asierra
Kilo Explorer

You can change the settings to calculate the Risk with a Business Rule rather than waiting for the user to click on the link (UI Action). To do this, go to [System Properties] -> [Change Management] and set the Change Risk calculation method from [UI Action] to [Business Rule].

The [Business Rule] method will be executed each time a record is created/updated.


adiddigi
Tera Guru

Hi,
The changing of the put of box field somehow did not work 😞 I went through the business rule,and then found that it is actually calling a Script include. But since the business rule is on change_request,and the table is not being updated/inserted in any way ,the businessrule is not getting fired.

I found out a method to call the risk assessment plugin ,but calculate the risk on your own ;).For this you need to modify the script include,
SurveyProcessor
so that a new instance is created everytime the user fills in the form(Currently the instance which is already present is being used)
So you need to write a private method in the script include and call this in every calculation of instance



_getNewInstance : function(/*String*/user, /*String*/survey, /*boolean*/bUpdate) {
var gr = new GlideRecord('survey_instance');



gr.initialize();
gr.setValue("taken_by", user);
gr.setValue("survey", survey);
gr.setDisplayValue("taken_on", gs.nowDateTime());
gr.insert();

var instance = gr.getUniqueValue();
//gs.addInfoMessage(instance);
return instance;
},

Now you need to write a business rule on Survey_response, with the following code


var gr3 = new GlideRecord("survey_response");
gr3.addQuery("instance", current.instance);
gr3.query();

var gCount = gr3.getRowCount();
//gs.addInfoMessage(gCount);
if(gCount == '11'){
var gr = new GlideRecord("task_assessment");
gr.addQuery("instance", current.instance);
gr.query();
gr.next();
//gs.addInfoMessage(gr.task);
var riskLevel=0;
var gr1 = new GlideRecord("change_request");
gr1.addQuery("sys_id", gr.task);
gr1.query();
gr1.next();

while(gr3.next()){
//Write your logic for calculating the questions using gr3 object
gr1.update();
}