ERM : Risk RAM conversion from 5x5 to 6x6

SagnicD
Tera Contributor

Hi All,

We got a requirement from Client to convert 5x5 RAM to 6x6 RAM. So is it possible to do so.

1 REPLY 1

SagnicDas_dev
Mega Guru

HI @SagnicD ,

Yes It's Possible.

We need to create a Business rule to map the 5x5 Matrix to 6x6.

Conditions : 

Table : 

Risk Assessment Instance Response [sn_risk_advanced_risk_assessment_instance_response]


When : After
Action : Insert, Update
Condition : Assessment Instance.Risk Assessment Methodology  is  ( Select your Assessment Methodolody )

code :

(function executeRule(current, previous /*null when async*/ ) {


    var sys = current.assessment_instance_id;
    var rec = new GlideRecord("sn_risk_advanced_risk_assessment_instance");
    rec.get(sys);

    var res = new GlideRecord("sn_risk_advanced_risk_assessment_instance_response");
    res.addQuery("assessment_instance_id", rec.sys_id);
    res.orderBy("sys_updated_on");
    res.query();

    while (res.next()) {
        var type = res.getValue("assessment_type");
        if (type == 1) {
            if (res.factor.getDisplayValue() == "Impact  (ERM RAM 6x6: MOE (With Inherent))") {
                var impact = res.getValue("qualitative_response");
                var calcImpact = res.getValue("u_normalized_score1");
                //normImpact = parseInt(normImpact);
            }
            if (res.factor.getDisplayValue() == "Likelihood (ERM RAM 6x6: MOE (With Inherent))") {
                var likelihood = res.getValue("qualitative_response");
                var calcLikelihood = res.getValue("u_normalized_score1");
                //normLikelihood = parseInt(normLikelihood);
            }
        } else if (type == 3) {//
            if (res.factor.getDisplayValue() == "Impact  (ERM RAM 6x6: MOE (With Inherent))") {
                var impactResidual = res.getValue("qualitative_response");
                var calcImpactResidual = res.getValue("u_normalized_score1");
                //normImpact = parseInt(normImpact);
            }
            if (res.factor.getDisplayValue() == "Likelihood (ERM RAM 6x6: MOE (With Inherent))") {
                var likelihoodResidual = res.getValue("qualitative_response");
                var calcLikelihoodResidual = res.getValue("u_normalized_score1");
                //normLikelihood = parseInt(normLikelihood);
            }
        }
    }
    // gs.info("Residual BinitaImpact " + calcImpactResidual);

    // gs.info("Residual  BinitaLikelihood " + calcLikelihoodResidual);
    var inherent = calcImpact * calcLikelihood;
    var residual = calcImpactResidual * calcLikelihoodResidual;

    // gs.info("Residual  Binitainherent " + residual);
    var inherentRating = "";
    var residualRating = "";

    if (type == 1) {
        if (inherent > 0 && inherent <= 6) {
            inherentRating = "Low";
        } else if (inherent > 6 && inherent <= 13) {
            inherentRating = "Moderate";
        } else if (inherent > 13 && inherent <= 19) {
            inherentRating = "High";
        } else if (inherent > 19 && inherent <= 25) {
            inherentRating = "Very High";
        }

        rec.setValue("u_computed_impact_score", impact);
        rec.setValue("u_computer_likelihood_score", likelihood);
        rec.setValue("u_calculated_impact", calcImpact);
        rec.setValue("u_calculated_likelihood", calcLikelihood);
        rec.setValue("u_calculated_inherent_score", inherent);
        rec.setValue("u_calculated_inherent_rating", inherentRating);
        rec.update();


    } else if (type == 3) {
        if (residual > 0 && residual <= 6) {
            residualRating = "Low";
        } else if (residual > 6 && residual <= 13) {
            residualRating = "Moderate";
        } else if (residual > 13 && residual <= 19) {
            residualRating = "High";
        } else if (residual > 19 && residual <= 25) {
            residualRating = "Very High";
        }

        rec.setValue("u_computed_impact_residual", impactResidual);
        rec.setValue("u_computed_likelihood_residual", likelihoodResidual);
        rec.setValue("u_calculated_impact_residual", calcImpactResidual);
        rec.setValue("u_calculated_likelihood_residual", calcLikelihoodResidual);
        rec.setValue("u_calculated_residual_score", residual);
        rec.setValue("u_calculated_residual_rating", residualRating);
        rec.update();
    }

})(current, previous);


Use the code above and if you get it helpful please markit as helpful.

Regards,

Sagnic