Saturday, 29 December 2012

Time Trigger on Salesforce.com Basics

16:26
   What are Time Triggers?

Time triggers are used when we need to execute workflow actions at certain time based scenarios
E.g. If we need to send an email to an employee 6 days after he joined
Or if we need to update a field or send an outbound message, two hours after the Lead has been qualified.

·         How to Create Time Triggers?
Time Triggers can be created in two ways
o   Apex Cron Jobs
o   Force.com Admin Setup


·         Via Point and Click
This post illustrates this method of creating time triggers, more about cron jobs later.
There are basically 3 steps in creating a time trigger/ time based workflows

We need to create a basic workflow rule in order to add time dependent actions to it.
A basic workflow creation is explained below; you could also watch a video

            Step 1: Creating a Workflow Rule and Select Object
§  Navigate to Your Name à Setup à Create à Workflows and Approvals
                                Click New
§  Select the Object to which the workflow rule applies to and click next
Step 2: Configure a Workflow Rule
§   Enter a name for the workflow rule, Select an Evaluation Criteria and select criteria on which the workflow is fired. You could also write your own formula instead of the criteria. Here are some examples for some common workflow criteria and click next
Step 3: Specify Workflow Actions
§  There are 2 types of actions that can be selected
a.       Immediate Workflow actions: Those are executed at the time workflow rule is fired and evaluates to true.
b.      Time- Dependent Workflow actions: These are the actions we are more interested in.

Time Depended Actions are executed when the specific time selected is selected, when defining a time trigger, use standard and custom date and date/time fields defined for the object. Specify time using days and hours

After defining a time trigger you can add new actions or existing ones to it. Following video explains more on creating a workflow rule.