0

I use scheduler + batch apex + Messaging.SingleEmailMessage to send out reminder emails every 2 weeks to a specific set of users in a public group!!!

Is this a decent approach/ is there any other alternative approach that I can do using time based workflow which I can take?

  • Are these reminders for tasks that haven't been completed? – Daniel Hoechst Nov 5 '12 at 22:47
  • Nope the reminders are intended to just remind them that they need to fill out some fields, the template is very general template that says "Please go to the account ABC and update the fields pending for the week 1) name 2) contactinfo " – Rao Nov 5 '12 at 22:50
  • Do you have some sort of rules that define when a user needs to update these fields? I'm sure you could do something with a time based workflow. – Daniel Hoechst Nov 5 '12 at 22:57
  • Time based ones fire only once if I recall correctly. This sounds like a periodic task so I'd go with batch apex as well. Recently we got option to assign tasks to groups but the reminder there is also one-time I think. Can you simply mass create (recurring) Events in calendars? – eyescream Nov 5 '12 at 23:05
  • I want something simple!!! The current scheduler is doing the job perfectly as expected. Was just curious to know if there was a simpler approach!!! @eyescream creating mass events would affect another part of the team where a email gets triggered based on event creation so not an option – Rao Nov 5 '12 at 23:07
3

Since you require a proactive scan, Scheduled Apex would be the recommended approach.

You could have a hidden Date field on Account called FieldsLastUpdated__c

Have a workflow that fires each time the record is created or edited, check if the fields you're interested in are updated (using ISCHANGED()) and if they have been updated, set this date to TODAY()

This now signifies that those fields were updated on the Date stamped in the FieldsLastUpdated_c

Have a simple batch class that runs each night, and scans for Account records where FieldsLastUpdated__c < Date.today().addDays(-14) i.e. 2 weeks using the QueryLocator

Now in your execute cycle through these Account and for each create an email for the owner, and the finally bulk send.

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.