1. Create a custom field Previous_Case_Status__c in the Case object to capture or store case’s previous status in Salesforce.
2. Use the following trigger.
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;
}
}
}
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;
}
}
}