You need to sign in to do that
Don't have an account?
SKollcaku
Send automatic Email to user when an Apex job terminates its execution
Hi everyone,
We have an Apex job/batch which executes each week and deletes all Contact records whith a certain condition (let suppose, ActivationDate__c older than 24-months).
How should I edit this Apex job in order to send automatically an Email to a Salesforce user whenever it finishes to comunicate the result (such as: success or failure/exception)?
Thank you so much,
Skender
For example:
Reference: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm" target="_blank)
All Answers
For example:
Reference: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm" target="_blank)
Firstly, you need to abort the process to modify anything in the running class, then you can add the logic of sending mails in your finish method of the batch Apex.