Trigger to store case's previous status in Salesforce

Sample Trigger:

trigger Case_BU on Case (before update) {
    for(Case cas : trigger.new) {
        if(cas.Status != trigger.oldMap.get(cas.Id).Status) {
            cas.Previous_Case_Status__c = trigger.oldMap.get(cas.Id).Status;
        }
    }
}

Cheers!!!

No comments:

Post a Comment