I have a requirement to show # of open Task on Lead Detailpage. Below is the logic that we are planning to implement. I would like tocheck with you if any one has implemented similar functionality handling BULK insert/update.If so could you please share the code?
Trigger on Task <after insert after update>
for (Task thistask : Trigger.new)
// Get all leads assosited to Tasks
FOR each Lead
SelectCount() from Task where whoId=LeadId and Status=Completed
Updatecustom field “ Open Task” on Lead object
Thank You .