One of the things salesforce.com lacks is a decent analog to “cron”, the ubiquitous unix/linux job scheduling tool. This is a kludgey but mildly amusing solution. (Here’s a simple, less kludgey cron that’s all native SFDC, which is probably a better idea if it meets your needs).
In order to implement this version, you’ll need a Google account with access to GCal and GMAIL, and a SFDC developer account.
The basic idea is to use Google Calendar as a signal to SFDC that it’s time to run a process. The works because of the Calendar’s reminder feature. The Calendar fires off a reminder email to the linked GMAIL account. GMAIL forwards that to SFDC. SFDC receives the message and does something (represented below by calling a “delegate”).
Eh voila! You have a rough analog to cron. (BTW, you could do this with any calendar that sends a reminder — Yahoo, etc.)
The basic flow looks like this:

Stepwise deployment:
- Setup your SFDC developer account.
- Setup your Google account.
- In SFDC, create a delegate — an Apex class callable from the Messaging.InboundEmailHandler) that does whatever you want to have happen on a regular basis.
- In SFDC, configure an Email2Apex InboundMessage handler APEX class. Note that this handler has to match the interface, but it doesn’t actually need to do anything with the email itself.
- In SFDC, configure the Email Service and setup an email address to accept alerts.
- In GMAIL, go to settings and configure the forwarding option so it goes to the SFDC email address you configured above.
- In GCal, configure your system to sent automatic reminders via email. This is under Settings > Calendars > Notifications.
- In GCal, schedule a recurring event. Make sure the event it setup to send a reminder or that your default calendar settings send a reminder.
Email Services Picture:
Email Service Configuration (with email address):
Some pluses of this approach:
- Facilitates a variety of signal times. With the time based workflow and trigger method, you are pretty much stuck with a pretty steady schedule that only operates in a minimum of hour increments.
- Email2Apex Inbound Message handlers have a larger DML limit than triggers. (100 instead of 20).
- Pretty easy, no code or hosting required.
- Doesn’t consume a custom object. (Yes, I have run into people who have run out of custom objects.)
Some minuses of this approach:
- Two systems. Two distinctly different systems. Management needs to be handled twice, people have to remember where the signal is coming from, etc.
- Email, although pretty darn good, is far from a perfectly reliable signal.
Possible Enhancements
- You could use the SFDC provided APEX Google Calendar API to create the recurring events. That would reduce the number of perceived systems involved. Say you wanted to create an SFDC custom object that stored cron style settings and then in the background it managed the details of configuring the recurring events. Actually, this sounds mildly amusing. If you develop this, I’ll gladly buy you a cup of decent coffee.
- If you have a number of items that need to be scheduled, you can actually use GMAIL filters based on the GCal subject line to either a) forward to different InboundMessageHandlers (if you need different schedules) or b) put a tree in the single handler that sends tasks off to different delegates.
(BTW, I haven’t looked to see if this idea is compliant with any of the players’ terms of service–at your own risk.)



