Business rule

Bhavani1995
Tera Contributor

Create BR for when a VIT/AVIT/CVIT get's reassigned from one of the groups mentioned below to another group. The Due Date field get's updated based on the risk rating and whether it's internet facing or not. The Due Date field will add the relevant amount of days to the date of the reassignment and apply 

 

Risk RatingConfiguration Item.Internet FacingDue Date
CriticalYes30
HighYes30
MediumYes60
CriticalNo60
HighNo60
MediumNo90
1 REPLY 1

Deepak Shaerma
Kilo Sage

Hi @Bhavani1995 

// Define variables for risk rating and internet-facing status
var dueDateDays;

// Check the risk rating and internet-facing status
if (current.risk_rating == 'Critical') {
    if (current.internet_facing == 'Yes') {
        dueDateDays = 30;
    } else {
        dueDateDays = 60;
    }
} else if (current.risk_rating == 'High') {
    if (current.internet_facing == 'Yes') {
        dueDateDays = 30;
    } else {
        dueDateDays = 60;
    }
} else if (current.risk_rating == 'Medium') {
    if (current.internet_facing == 'Yes') {
        dueDateDays = 60;
    } else {
        dueDateDays = 90;
    }
}

// Update the Due Date field based on the calculated days
if (dueDateDays) {
    var reassignmentDate = new GlideDateTime(); // Get current date/time
    reassignmentDate.addDays(dueDateDays); // Add the calculated days
    current.due_date = reassignmentDate; // Set the new Due Date
}


Thanks & Regards
Deepak Sharma