Populate 'Risk Value' field on Change Request Form after Risk Assessment

anupamg
Tera Guru

Hi forum

We want to populate field called 'Risk Value' on the Change form with the Risk Assessment's total value based on which it marks Risk as low, medium or high.

Please guide if it is possible and if we have any Business rule and script include to populate it.

Any guidance is really appreciated.

Thanks

Anupam

5 REPLIES 5

RakeshBhairi
Tera Contributor

You can Write an After BR on 'Assessment Instance' Table with conditions as state is complete and metric type is change Risk assessment.

//Calculate Risk Value
var score = 0;
var gr = new GlideRecord('asmt_assessment_instance_question');
gr.addQuery('instance', current.sys_id);
gr.query();
while (gr.next()) {
score += parseInt(gr.getValue('value'));
}

var riskScore = new GlideRecord('change_request');
riskScore.addQuery('sys_id', current.task_id);
riskScore.query();
if (riskScore.next()) {
riskScore.risk_value = score;
riskScore.update();
}

 

I Hope this helps.

 

Please mark this helpful if this helps and mark as correct if this solves your issue.

 

Regards,

Rakesh