You need to sign in to do that
Don't have an account?
faceroy123
Bulkifying a trigger
Hi,
I have a trigger that sends an email once a field is updated (by a time based workflow).
Problem I have is that as time based workflows are processed in batches, this is only able to handle one update.
I guess I need to bulkify this trigger?! if so, how do I do that to the snippet below?
Thanks
trigger WorkflowEmailFromOwner on Task (before update) { if (trigger.new[0].escalated__c ==True && trigger.new[0].RecordTypeID =='012M00000008bZY' && trigger.new[0].number_of_updates__c ==0 ||(trigger.new[0].number_of_updates__c ==1)){ Task tas = [select id, t.Owner.Email, t.initial_assigned_to__c, t.title__c, t.description, t.subject, t.consignment_number__c, t.Owner.Name, t.whatid, t.number_of_updates__c from Task t where id = :trigger.new]; try{ messaging.Singleemailmessage mail=new messaging.Singleemailmessage(); //Save the Email in Activity History mail.setSaveAsActivity(false);
Best Answer chosen by Admin (Salesforce Developers)
Abhay Arora