You need to sign in to do that
Don't have an account?
Amlan Maiti
How to Bulkify trigger handler Code
Hi All,
I want to update some task ownerid in my task trigger handler code. I have tried a piece of code which is not bulkified. Can you please help me with the bulkification of the same.
Thanks in Advance.
I want to update some task ownerid in my task trigger handler code. I have tried a piece of code which is not bulkified. Can you please help me with the bulkification of the same.
Thanks in Advance.
List<task> taskWithoutClosedCases = new List<Task>(); //Some logic to add tasks in the above List if(mapId_Case!= null){ for(task objTask : taskWithoutClosedCases){ if(isInsert){ if(objTask.Override_Default_Assigned_To__c == false && objTask.IsClosed == false){ List<Mapping__c> mappingRecord = [SELECT ID, Assigned_To__c FROM Mapping__c where Business_Unit__c=:objTask.Contact_Center_BU__c AND Task_Type__c=:objTask.Task_Type__c AND Type__c = 'Task Type - Assigned To']; if(mappingRecord.size() > 0){ if(mappingRecord.get(0).Assigned_To__c != null){ objTask.OwnerId = mappingRecord.get(0).Assigned_To__c; }else if(mappingRecord.get(0).Assigned_To__c == null && mappingRecord.get(0).Id != null){ objTask.OwnerId = UserInfo.getUserId(); } } } } } }
Sorry, looks like it didn't keep all my indents the way I intended them.