You need to sign in to do that
Don't have an account?
Trigger for bulk case update
I an new to salesforce and using Email to case to register new cases. Once the case is registered it moves from one department to another before it is closed. This is done by changing the Lookup field Department__c (Lookup to custom object Department__c) on Case. Each time dept is changed, a record is inserted in the Dept_move__c custome object Which is detail with Case as master. When the case is closed, it is assigned a new page layout -- Closed Case Page Layout that has no Close Case Button and also email is sent to the customer with case details. If customer feels that the problem is still pending, he can reply to that and it will automatically reopen the case. I have already implemented this functionality through after update trigger on Case.
It work fine with single case update but I need to modify it so that it can work for multiple or bulk case updates. Can anyone suggest me what point i should consider while updating the trigger for handling bulk cases:
Ah, no, you can't insert with workflow.
See all those places where you reference trigger.new[0]? That's your problem. You're only touching the first case on the list. You should be doing most of that in a for loop (except for queries, inserts and updates, which you should do outside the loop).
All Answers
Ah, no, you can't insert with workflow.
See all those places where you reference trigger.new[0]? That's your problem. You're only touching the first case on the list. You should be doing most of that in a for loop (except for queries, inserts and updates, which you should do outside the loop).