function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
trigger CaseTrigger on Case (before update) { if(Trigger.IsBefore && Trigger.IsUpdate){ for(case cs : Trigger.New){ if(cs.Status == 'Escalated' && Trigger.oldMap.get(cs.Id).status == 'New' && String.isBlank(cs.Description)){ cs.addError( ' Please provide description to escalate the case ' ); } } } }
trigger CaseTrigger on Case(before insert) { if(trigger.isbefore && trigger.isinsert) { for(Case caseRec: trigger.new) { if(Trigger.oldmap.get(caseRec.id).Status =='New' && caseRec.Status== 'Escalated' && String.isBlank(caseRec.Description)) { caseRec.adderror('Description cannot be empty while escalating'); } } } }
trigger CaseTrigger on Case(before insert){ if(trigger.isbefore && trigger.isinsert) { caseRecordError.getCase(Trigger.New,Trigger.oldMap); } } public class caseRecordError{ public static void getCase(List<Case> caseList, Map<Id,Case> oldmapValue){ for(Case Case caseRec:caseList){ if(oldmapValue.get(caseRec.id).Status =='New' && caseRec.Status== 'Escalated' && String.isBlank(caseRec.Description)) { caseRec.adderror('Description cannot be empty while escalating'); } } } }
Use the before update trigger.
Thanks,
Maharajan.C
All Answers
You can try the below snippet:
Please note this is a sample snippet and you need to modify it accordingly.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
Use the before update trigger.
Thanks,
Maharajan.C
Kindly mark this as the best answer, If you find this answer helpful.