function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sugandha aryasugandha arya 

send email alert to community users using batch apex schedulable

Hi everyone,
I need help in writing batch apex as i have never worked on this.I have one custom object with field named "Due date__c" If a new record is created in that object,then its due date will be populated with (record created date+3 months).At the time of record creation I want to send email notification weekly or monthly to community users to make payments before due date and also after due date is passed to those whose payments are still not done yet.
Anupama SamantroyAnupama Samantroy
Hi Sugandha,

1. For the first requirement where you want to add  3 months to the due date. You can create a workflow rule which will have a field update to update the duedate to duedate+3 months(straight forward add 3 months).
Alternativey if you have to consider all leap year and things please refer the link https://help.salesforce.com/apex/HTViewSolution?id=000213475&language=en_US
2. For the second requirement if you want to write a Batch Class then please refer the link below.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm

Hope this will help.
Thanks
Anupama