HI I have the following field value.

  1. type (pick-list) values [daily, weekly]
  2. Count (number).
  3. end date If I choose daily and 2 in the above field. two mail should send to the owner. till the endate field.

How to achieve this?


You can achieve this by adding a 4th field: "Next Email" (Date Time). There you can store a date at which you want to send the next email.

Solution 1

  1. Create a workflow (time-based). Add a workflow action to send the email.

  2. Create a scheduled batch job. (And run your scheduled batch job every 15 min). Query all records WHERE NextEmail__c < Now. For each of these records, you can set a new "Next Email Date" based on your 3 fields above.

Solution 2

Create a trigger within the trigger you can update the next Email field based on your criteria. In a second step, you schedule a job (through your trigger).

The scheduled job updates the Next Email Field based on your criteria and send a new mail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.