Pages

Tuesday, March 26, 2013

Salesforce Time-Dependent Workflow and Entry Criteria

Time-Dependent Workflow is a very nice feature out-of-the-box from Salesforce. You can easily configure it to do action such as: create task, send email alert, field update and send outbound message. The actions will only trigger when before or after certain date or hour as configured.

Actions for Time-Dependent Workflow is exactly the same with Immediate Workflow, and you can share the same actions between Time-Dependent Workflow with Immediate Workflow, depend on your business needs, even to combine Time-Dependent and Immediate workflow in the same workflow rule.

One thing you need to note when create Time-Dependent Workflow is the Evaluation Criteria, make sure it is set to created or created, and any time it’s edited to subsequently meet criteria only. Created, and every time it’s edited will NOT allow you to have Time-Dependent Actions.



I get a request from my user to change a running Time-Dependent Workflow from 7 days before Birth date to 14 days before Birth date. Here is the step:
  1. Take a screenshot of existing Time-Dependent Workflow with the actions (for backup purpose)
  2. Deactivate the workflow
  3. Delete all Time-Based Workflow queue related to the workflow, from SetupMonitor - Time-Based Workflow, you can take screenshots as backup purpose.
  4. Edit Time-Dependent Workflow, once step 3 done, you will see Edit link next to the time trigger. For this sample, let's modify the day to 14 days.
  5. Activate the workflow rule

Notes:
1. Deactivate workflow rule (step 2 above)
This activity will NOT delete time-dependent actions are placed in the workflow queue.

2. All existing data will NOT trigger again for the Workflow
Because it already met the entry criteria earlier. So, if your Entry Criteria is 'Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria', you need to make the record to 'meet' the criteria again:
  • Update the record NOT to meet the criteria, then update it back to meet the criteria.
  • Example: if we are using Rule Criteria "Birth date NOT EQUAL TO null", we need to make it to null (make sure to backup), then populate the original Birth date back, so it will meet the criteria again.

3. Monitoring
You can monitor record in queue to be triggered for Time-Based Workflow from Setup - Monitor - Time-Based Workflow. You can select some criteria to monitor the queue or just leave all to --None-- and hit Search button.


Limitation and Idea:
The time based workflow queue is not queryable via Apex, or the API or run a report.
Vote for this idea to have ability to export Queue of Time Based Workflow.



No comments:

Post a Comment