Time-dependent actions
Actions can be executed hours or days after a given date.
To add time-dependent actions, the workflow must be inactive and the evaluation criteria must not be set to Evaluate the rule when a record is created, and any time it’s edited to subsequently meet the criteria.
Remove the Notify if Lead is not yet contacted email alert from the immediate actions, as shown in the following screenshot:
Workflow rule ready to be linked with a time-dependent action
Now click the Add Time Trigger button and select the appropriate time definition:
Time-dependent trigger editing
This is what you see on the workflow editing form:
Time-dependent trigger enabled on workflow
Now you can add the existing email alert:
Action added to the time-dependent trigger
After the lead is created, the action executes after two days, and only if the rule criteria is still valid; this means that if the lead changes its status, the email is not sent (this prevents unwanted email alerts being sent if the record changes).
You can add multiple actions to the same time trigger and add more than one time-trigger per workflow.
The most notable limitation when using time-dependent actions is that Salesforce limits the number of executions to 1,000 per hour; any extra workflows are executed during the next hour.
Another requirement when using time-based workflows is that we need to define a default user in case the user that fired the workflow is no longer active when the action executes; this can be done from Setup | Process Automation | Process Automation Settings on the Default Workflow User field.
It is possible to monitor pending time-based executions from Setup | Environments | Monitoring | Time-Based Workflows:
Time-based workflow monitoring panel
For further considerations on time-based workflows, refer to Salesforce Help at https://help.salesforce.com/articleView?id=workflow_time_action_considerations.htm&type=5#workflow_field_updates_reevalute_wf.
Further considerations on workflows
Workflows has a few limitations that should be considered when choosing this technology; here are some of the most relevant (as of winter 2020):
- Total inactive and active rules across objects (including workflows, assignment rules, auto-response and escalation rules): 2,000
- Total inactive and active rules per object: 500
- Active rules per object: 50
- Immediate actions per workflow: 40 (up to 10 for each action type)
- Time-based trigger per workflow: 10 (up to 10 for each action type)
- Time-based workflow execution per hour: 1,000
- Email alerts allocation per day: 1,000 alerts per standard license, up to 2 million
For more details on workflow limits refer to Salesforce Help at https://help.salesforce.com/articleView?id=workflow_limits.htm&type=5.
Before closing the chapter, let’s list some considerations about adopting workflows on your business automations:
- When a custom object is deleted, workflow rules on that custom object are deleted as well.
- It is possible to run cross object field updates on accounts/opportunities when a lead is converted (use the Require Validation for Converted Leads on the Setup | Features Settings | Marketing | Lead Settings page).
- The order of the automated actions is not guaranteed, although field updates are always executed first.
- If you replace one or more workflow rules to replace an Apex trigger (or vice versa) remember to disable the trigger before activating the workflow rules; otherwise, both will be executed and you get unexpected automated behavior.
- Workflow rules are executed when a child standard or custom object with a master-detail field is re-parented.
- If the organization uses multiple languages, create a workflow using your own language (up to 25 filter criteria of 255 characters each), but remember that if you are using picklist filtering, the system uses the default value in the criteria, so you should use the values of the original language the workflow rule was created with when editing the rule (change the company default language accordingly).
- When using filter on record type labels, always use the master label and not the translated label; otherwise, the workflow won’t trigger at all.
- A workflow rule doesn’t fire if a condition has a reference to a field that doesn’t have a value. For example, if a criteria is defined on the contact object where Account.Active__c == true, but the Contact.AccountId field is blank, the criteria is not matched and the workflow won’t fire at all. In this situation use formula criteria to check whether the field is filled in or not.
- There are some actions on the Salesforce setup that don’t trigger rules:
- Replacing picklist values
- Changing territory assignments on accounts and opportunities
- Converting leads to person accounts
- Deactivating self-service portal, customer portal, or partner portal users
For more information about using workflows, see Salesforce Help at https://help.salesforce.com/articleView?id=workflow_rules_considerations.htm&type=5.
This section helped us understand further the work considerations of workflows.
Summary
We have seen what process automation is and the declarative tools that the platform supports. We dug into workflows and how they can be configured with different kinds of actions with field updates, task actions, email alerts, and outbound messages to help us understand how they work and how to use them.
In the next chapter, we’ll analyze approvals, another useful automation feature, which delivers approval processes for our records.