You need to sign in to do that
Don't have an account?
Logic to satisify email and soql limits on InstallDate of Asset
I've been tasked with the following:
1. Identify all assets with an Install Date of Today.
2. Identify the Contact and Public Group Users associated with the Asset.
3. Email all identified people with details about their asset.
Because of the Salesforce limits of only being able to send out 10 emails and online invoke 100 SOQL statements, I have not been able to find logic that will successfully satisfy this requirement.
I was going to use Mass Email, but it will not work with WhatIds of Assets (not will it allow me to connect users to the Asset).
I have had success in sending the email through a trigger when the Install Date is entered line by line, but any Mass Updates fail because of the limits mentioned and the requirement being to identify the individuals and Information per Asset Record.
Any assistance would be greatly appriciated.
I reckon you're trigger will fail at some time too. Since salesforce batches up 200 records at a time, and you are allowed 10 single email calls per transaction you will run into problems with email limits.
Its way more complicated than it should be, but the folowing approach should work:
You will have to come up with a way to identify the contacts that are to be emailed. Either by using a custom object to create a list of contacts or adding a custom field to contact.
I have written something like this before. If i locate it i will post it.
try this as a start point for your batch apex. I built a visualforce page to fire off the batch process for 10 items at a time.