In change request, how do i calculate both risk and impact using only risk assessment?

MukeshP203
Tera Contributor
The risk assessment includes the following two additional fields:
Could this cause a severe outage? (Yes/No)
-If marked as Yes, the CR is marked as "High Risk".
-If marked as No, the risk assessment runs with the standard OOTB functionality.
What is the business criticality of this CR/Item?
-If the criticality is High, the Impact is marked as High.
-If the criticality is Low, the Impact is marked as Low.
6 REPLIES 6

I am trying to take an approach where i am using risk conditions advanced script to tap into the answers of the risk assessment questions and then set the Impact. Here is the incomplete background script i am trying to get that particular assessment instance, created when the risk assessment form is answered, linked with the Change Request.

 

var mat = new GlideRecord('asmt_metric_type');
    mat.get('415f1e131bde56106cb85204604bcba7');
    mat.query();

    if(mat.next()){

        gs.print(mat.name);
    }
    var changeRecord = new GlideRecord('change_request');
// changeRecord.orderByDesc('sys_created_on');
changeRecord.query();

if(changeRecord.next()){

var changeSysId = changeRecord.sys_id;
changeRecord.get(changeSysId);
gs.print("@change sysid"+changeSysId);

}
    var assIns = new GlideRecord('asmt_assessment_instance');
    assIns.addQuery('task.sys_id',changeSysId);
    // assIns.orderByDesc('sys_created_on');
    // assIns.query();
    if(assIns.get('415f1e131bde56106cb85204604bcba7')){

        gs.print(assIns.name);
    }


    var gr = new GlideRecord('asmt_metric_result');
gr.addEncodedQuery('actual_value=8^metric.name=Business Criticality^source_id=29a4b7181b2e5e106cb85204604bcb9e');
gr.query();

  if(gr.next()){

        gs.print(gr.actual_value);
}
 
I am able to get the instance but that is linked to some different metric type and  i want that particular assessment instance that is linked the the change request on which the risk assessment is calculated?
Also i am not able to query metric_type from assessment instance.

   

 

Sorry mate , scripting and me are not good friends, so tough to help here.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************