You need to sign in to do that
Don't have an account?
SalesforceCrm AccountCRM
Send email notification to the owner of the record 30 days before the contract end date
Hello All,
I have a requirement where i need to send an email notification to the contract owner 30 days before the contract end date , when the contract role is 'SA/EB?TA' etc.Any suggestion with an example very much appreciated.
I have a requirement where i need to send an email notification to the contract owner 30 days before the contract end date , when the contract role is 'SA/EB?TA' etc.Any suggestion with an example very much appreciated.
Please find the below code:
Here I considered:
(1) Included Contract's Email.
(2) Added the code in finish method.
(3) Implement with Schedulable so that you can write the schedulable code here it self.
Please do let me know if it helps you.
Regards,
Mahesh
All Answers
You can achieve it with Time Dependent Workflows.
Here except Criteria everything is matching to your requirement, you can add the Criteria accordingly to your requirement.
https://help.salesforce.com/HTViewHelpDoc?id=workflow_time_action_considerations.htm&language=en_US
https://help.salesforce.com/HTViewHelpDoc?id=workflow_examples.htm
https://www.shellblack.com/administration/time-dependent/
https://www.shellblack.com/whiteboard/workflow-rules-immediate-and-time-dependent-actions/
https://www.youtube.com/watch?v=0n26RLubhBA
http://www.simplysfdc.com/2013/03/salesforce-time-dependent-workflow-and.html
Please do let me know if it helps you.
Regards,
Mahesh
Try to use salesforce Batch job for same and schedule the batch job in late night which will fatch all record where we need to send email (30 days one ). Please check below post for help
1) http://amitsalesforce.blogspot.in/2016/02/batch-apex-in-salesforce-test-class-for.html
Batch Apex
A Batch class allows you to define a single job that can be broken up into manageable chunks that will be processed separately.
Sample Batch Apex
1) Start method is automatically called at the beginning of the apex job. This method will collect record or objects on which the operation should be performed. These record are divided into subtasks & passes those to execute method.
2) Execute Method performs operation which we want to perform on the records fetched from start method.
3) Finish method executes after all batches are processed. Use this method to send confirmation email notifications.
Please start coding we will help you
I assume that 'Contract' is the Master and 'Contract Role' is the Detail object.
Created a formula field to get the Master's means Contract End Date on the Contract Role object.
Regards,
Mahesh
Please find the below code:
Here I considered:
(1) Included Contract's Email.
(2) Added the code in finish method.
(3) Implement with Schedulable so that you can write the schedulable code here it self.
Please do let me know if it helps you.
Regards,
Mahesh
In your query you can add
Owner.Manager.Email
Please find the below modified code:
Please do let me know if it helps you.
Regards,
Mahesh
In your query you can add:
Account.Owner.Manager.Email
Regards,
Mahesh
Similary when the Account owner / Manager --- fills the field as NO , then we need to stop sending the email notification.
So can we have 'n' of if conditions in batch class.Any help very much appreciated.
Please open a new discussion for this as we mixed up many thing into this, which is not good.
Please mark it as solved and open a new discussion so that it will be helpful to others in the future.
Regards,
Mahesh
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000DEhEIAW
Any suggestion.