You need to sign in to do that
Don't have an account?
GMASJ
How to by pass case assignment rule
Hi,
I want to add a condition to by pass the case assignment rule for below trigger is working as expected only this I want to add by pass case assignement rule.
I want to add a condition to by pass the case assignment rule for below trigger is working as expected only this I want to add by pass case assignement rule.
Trigger ====== trigger CaseTrigger on Case (Before Insert, Before Update,After Insert, After Update){ if(Trigger.isAfter ) { if(AvoidRecursion.isFirstRun()) { CaseTriggerUtils.processInsert(Trigger.newMap); CaseTriggerUtils.processUpdate(Trigger.newMap, Trigger.oldMap); } } } Class ===== public class CaseTriggerUtils { public static void processInsert(Map<id, Case> newMap) { processUpdate(newMap,newMap); } public static void processUpdate(Map<id, Case> newMap, Map<id, Case> oldMap) { String FWSubject; String RWSubject; String CaseSubject; list<Case> caseLst=new list<Case>(); boolean isExecuted = True; for (Case c : newMap.values()) { // Remove FW and RW from case subject to get exact string if(c.subject.Contains('FW:')){ FWSubject = c.subject.replaceAll('FW:',''); System.debug('FQ Trim String :' + FWSubject); CaseSubject = FWSubject; } else if(c.subject.Contains('RW:')){ RWSubject = c.subject.replaceAll('RW:',''); System.debug('RW Trim String :' + RWSubject); CaseSubject = RWSubject; } else { CaseSubject = c.subject; } } // Query to get list of all case subject values list<case> ctendays = [select id, casenumber,subject,createddate,ownerid,owner.name from case where CreatedDate = this_year and subject like :('%' + CaseSubject + '%') order by createddate asc limit 100]; for(case ctndays : ctendays){ system.debug('Existing Cases :' + ctndays.casenumber + ' ' + ctndays.subject + ' ' + ctndays.createddate + ' ' + ctndays.owner.name); system.debug('Latest Case Owner ' + ctendays[0].owner.name); // If case subject is more than 18 character if(ctndays.subject != null && ctndays.subject.length() > 18){ if(FWSubject <> null){ ctndays.subject = FWSubject; } else if (RWSubject <> null){ ctndays.subject = RWSubject; } } // Get the latest owner to assign ownership. ctndays.ownerid = ctendays[0].ownerid; ctndays.Duplicate_With__c = ctendays[0].casenumber; caseLst.add(ctndays); } if(caseLst.size()>0){ update caseLst; } } }
Raj Vakati
Try like this
System Admin19
This snippet code not working for me