You need to sign in to do that
Don't have an account?
sonam guptha
sending an email based on account.enddate__c on every month
HI,
Iam afraid as a begginer.
on a account table i have custom field termEndDate__c which was a formula field of type date,so when termEndDate__c is set to less than 90 days on a particular account, i have to send an email with the account name,and this has to done on monthly basis as a schedule and we need to include account name in the email,and has to check all the accounts in my salesforce org should send an email which accounts are less than 90 days. is it possible.please help me out
Iam afraid as a begginer.
on a account table i have custom field termEndDate__c which was a formula field of type date,so when termEndDate__c is set to less than 90 days on a particular account, i have to send an email with the account name,and this has to done on monthly basis as a schedule and we need to include account name in the email,and has to check all the accounts in my salesforce org should send an email which accounts are less than 90 days. is it possible.please help me out
You can try this
Working Perfectly in single email
excute sheduler class
If It works for you please slelect my answer is best answer
Thanks,
All Answers
You have to Use Process Builder or Workflow rule
I task was same for Opportunity Object.You have to use Account and your field instead of opp and custom field in attched snap.
It Will helpful for you i think.
1-4-create an email template before sending email
2--For Process Builder you have choose Object as Account
3-Run Your Proces when Account is created ot Edited
4-Your Criteria should be there
[Account].termEndDate__c -today()==90
5-Choose immidiate action as send email alert
choose your email template
6- Activate Process Builder
Enjoy it will work for you
If You like this this answer then don't Forget to make as Best Answer .
Thanks
Your logic for the schedulable class would need to be something like this:
- Write a query that grabs all accounts that are less than 90 days
- Loop through the records and create a single email message containing the account details and add the email message to a list of messages
- Insert/Send the emails in the email list outside of the loop/at the end
Here is info on writing emails in apex: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_email_outbound_single.htm
wf and PB work on any event happens like insert or update,but here i will not perform any operation manually,and it has send an email weekly wise by checking out all my account records.so we can use scheduler for weekly emails but how to check all the accounts?
thats what even iam thinking i will write some code if i strucked up any where please help me out thanks!
If you want Do this by code ,so you have to wtrie a batch class for it and weeekly basis run this to batch to send email notification only for those records who older than 90 days(account.enddate__c) using sheduler class.
I will help you for this code if you want.
Thanks
Batch Apex Class:
Schedulable Class:
Schedule the 'scheduleExpireNotify' as mentioned below in App Setup --> Apex Classes --> Schedule Apex and select 'sscheduleExpireNotify' class. Check Weekly and select all the days. Give Start and End dates and Preferred Start time and Click 'Save' button.
I you Need more Help Inform Me.
Thanks,
its not working as expected,i think we need to add if condtion to fire the email,and if there are more than 4,5 accounts will it grab those accounts or by default it will always gives us only one account name.
This is working code
try this code If It works for you please slelect my answer is best answer
Thanks,
SendEmail failed. First exception on row 0; first error: NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile.: []
setup--> Email Administration
-->Deliverability-->Access level Picklist Shoul be -->All Email
The reasons are :
>>Trial accounts do not allow the use of mass email. You will have to purchase a license to go live with your org.
>>You are missing a permission in the backend and must log a feature activation case with Salesforce support to enable "Respect SendEmail API" and "SendEmail API".
>>The access level might have been set to "system e-mails".
In setup | Administration setup | Email Administration | Deliverability, verify if the access level is set to "All e-mails".
The e-mail deliverability is a new feature released in spring 13 and as per the release notes, all newly refreshed sandboxes default to "system email only"
Other wise
Trial accounts do not allow the use of mass email. You will have to purchase a license to go live with your org.
i think you are using Dev org
this code will work in licence organization (production and in sandbox both)
https://help.salesforce.com/articleView?id=000002868&language=en_US&type=1
You can try this
Working Perfectly in single email
excute sheduler class
If It works for you please slelect my answer is best answer
Thanks,
its working,but it grabs the accounts more than 90 days even?
You can also use formula field which return type will number type
For the number of Days Remaining the formula would be:
Datatype = Formula
Result = Number
Formula = TheDateField__c - TODAY()