You need to sign in to do that
Don't have an account?
SFDCbox
Invoking a Batch job from Trigger
Hello All,
I have got an After Update trigger on Campaign which updates will update the Status of related Campaign Members (Lead/Contacts) when a campaign is updated to Active. I am invoking a batch job with a batch of 200, to update the lead and contact status. I know there can only be 5 batch jobs running simultaneously. How can i avoid getting the governer limits exception in case when i have a huge campaign?
Many Thanks in advance.
I have got an After Update trigger on Campaign which updates will update the Status of related Campaign Members (Lead/Contacts) when a campaign is updated to Active. I am invoking a batch job with a batch of 200, to update the lead and contact status. I know there can only be 5 batch jobs running simultaneously. How can i avoid getting the governer limits exception in case when i have a huge campaign?
Many Thanks in advance.
What I mean is, whenever a Campaign is set as Active, capture the date in a new field which can be called as "Activated on".
Now your scheduled batch can pick up all Campaign Members (Leads and Contacts) whose Campaign was activated today and update the records.
This way, you avoid invoking batch from a trigger and update all the records too.
Hope this helps.