Workflow Rules are automatic processes that trigger an action when a certain event occurs, such as updating a field on a specific object or creating a new record. An automated email alert is one of the actions that can be triggered by an event.
This article walks you through the steps to create a Workflow Rule that will trigger an email alert when a specific field is updated. Note that Salesforce offers two different methods to automate activities: Workflow Rules and Process Builder. This article describes how to set up these notifications with Workflow Rules as this is recommended for rules that trigger when a single record is updated.
Considerations when setting up a Workflow Rule
- Workflow rules on custom objects are automatically deleted if the custom object is deleted.
- The order in which individual actions and types of actions are executed is not guaranteed. However, field update actions are executed first, followed by other actions.
- Salesforce processes rules in the following order:
- Validation rules
- Assignment rules
- Auto-response rules
- Workflow rules (with immediate actions)
- Escalation rules
- Workflow rules can be triggered any time a record is saved or created, depending on your rule criteria. However, rules created after saving records aren't triggered by those records retroactively.
- Saving or creating records can trigger more than one rule.
- The following actions don't trigger workflow rules:
- Mass replacing picklist values
- Using the option to replace a picklist value while deleting the current value.
- Mass updating address fields
- Mass updating divisions
- Converting state and country data from the State and Country Picklists page in Setup
- Time-Based Workflow Rules, which are rules that are set up to trigger an action in the future, can always be monitored in Setup > Monitoring > Time-Based Workflow.
Create your Workflow Rule
Before you can create a notification, you need to have a rule in place that will trigger on a specific event.
The important thing to know going into this step is what object and field you are using to trigger the rule. For example, if you are going to send an email to a person’s supervisor when they complete a training record, then you will be using the Training Assignment object and at least the Training Assignment: Status field.
- Go to Setup > Automation Rules > Workflow Rules.
- You’ll see a list of all existing Workflow Rules in your org. Click New Rule.
- Select the Object your workflow rule applies to and click Next.
- Give your rule an unique Name and a Description. Descriptions are especially helpful for others who may be editing this rule in the future and trying to determine its intent.
- Set the Evaluation Criteria to determine when your rule will run. If you’re unsure, you can read Salesforce’s recommendations.
- Created: The rule will only ever run the first time the record is created, and only if the Rule Criteria is met.
- Created, and every time it’s updated: The rule will run when the record is created and any time it is updated as long as the record meets the rule criteria. So even if you later update the record with completely unrelated changes, the rule will run again.
- Created, and any time it’s edited to subsequently meet criteria: The rule will run when the record is created and then only when the record goes from not meeting the criteria to meeting the criteria. So if you later update the record with unrelated changes, the rule will not run again. This is the default and the option you’ll probably choose most often.
- Select your Rule Criteria:
- Selecting Criteria Are Met allows you to select from several operators.
- Selecting Formula Evaluates to True involves creating a formula that must evaluate to True. Formulas are beyond the scope of this article.
- Set the criteria that will determine when your rule will run:
- Field: Select from available fields to determine which field will be evaluated.
- Operator: Select from available options that will determine how your Value will be evaluated. For example, will the criteria be met when the field is “equal to” or “not equal to” your value.
- Value: Enter the value for your field you are evaluating on. If your field has picklist values, you can use the Lookup icon to find and select the appropriate value.
- Click Save & Next.
Note: You can add as many criteria as you feel are necessary. However, if you chose the default Evaluation Criteria, your rule will only run when ALL criteria are met. Keeping a rule simple is usually a good practice.
Set the Automated Action to your Workflow Rule
Now that you have your criteria set, which determines when your rule will run, you can add what will happen when your rule runs. In this case, it will be an Email Alert that is sent out.
Salesforce offers two different types of actions that can occur as a result of your Rule: Immediate Workflow Actions and Time-Dependent Workflow Actions. We’ll look at examples of each.
Immediate Workflow Actions are executed as soon as the workflow rule finishes evaluating the record. This is a good choice if you want a field to be updated or if you want an email alert sent immediately when the rule criteria is met.
Time-Dependant Workflow Actions are executed at a specific time, such as 10 days before a due date. When that specific time passes, the workflow rule re-evaluates the record to make sure that it still meets the rule criteria. If the record does, the workflow rule executes those actions. These are excellent for sending reminders that something, such as completing training, has not been completed and is coming due.
- If you are adding an Immediate Workflow Action, click Add Workflow Action in that section and select New Email Alert. Proceed to Step 3.
- If you are adding a Time Dependent Workflow Action, click Add Time Trigger.
- Set the time that the rule will re-evaluate the record to see if the criteria still exists to run the rule. You can choose the number of days or hours, before or after, the date on a specific field. So in the example below, 3 days before the Training Due Date, the rule will re-evaluate the record. Click Save.
- Back on the Specify Workflow Actions screen, the Time Dependent Workflow Actions section will display the trigger you just created. Click Add Workflow Action and select Email Alert.
- Proceed to Step 3.
- Enter a Description and Unique Name for your email alert. A good description will help others understand the purpose of the alert. The Unique Name is an API field, which means you can’t have spaces. Instead, use an underscore between words, such as “Email_Supervisor_Training_Complete”.
- In the Email Template field, click the Lookup (Magnifying Glass) icon and select from the list of available email templates. You must have your template already created. If you need help with email templates, go to our Customize Standard Email Templates article.
- Once you’ve selected an email template, you determine who will receive the notification. You can choose specific users, but those can be difficult to maintain. Instead, you can choose from Roles, Groups, and Related Users. That way, even if the person changes, you don’t have to update the rule.
- You can add up to 5 Additional Email addresses to receive the notification.
- Leave the From Email Address Field at the default and click Save.
- Back on the Specify Workflow Actions screen, click Done to finish the rule.
Activate your rule
The last step is to make your rule active.
- Back on the rule’s main screen, click Activate. The page will refresh and the Active field will now be selected.
- If you don’t have an active account set up as a Default Workflow User, you may get a popup notifying you of this. This is needed because when the user who triggered the rule isn’t active, Salesforce displays the username of the default workflow user in the the Sending User field for email. And if a problem occurs with a pending action, the default workflow user receives an email notification.
- Click OK to the popup message.
- If you aren’t taken to the screen to select the Default Workflow User automatically, go to Setup > Process Automation > Process Automation Settings.
- In the Default Workflow User field, click the Lookup icon and select the user.
- Click Save.
- Navigate back to your Workflow Rule. It should now be Active.
Monitor your Time-Based Workflow Rules
- You can monitor the Time-Based rules to wee which are in the queue and when they are scheduled to re-evaluate a rule.
- Go to Setup > Environments > Monitoring > Time-Based Workflow.
- Click Search. This will display a list of all upcoming time-based workflow rules.
- If you want to delete any of the pending alerts, you can select the checkbox beside the Record Name and then click Delete.
Issue: You receive an Hourly limit exceeded for processing workflow time triggers message via email.
Solution: You need to increase your org’s hourly limit on processing workflow time triggers. Most orgs are setup with a default limit of 50. However, you can contact Salesforce Support and request to have this limit increased to 1,000 at no additional cost.
Issue: You receive no error message but users are still not receiving email notifications.
- Solution: You can use the Test Deliverability function to troubleshoot the problem.
- Go to Setup > Email > Test Deliverability.
- Enter your email address and click Send. Salesforce will send up to 32 emails. You can use this to determine if emails are getting through correctly.
- To change your Email Deliverability settings, go to Setup > Email > Deliverability.
- Ensure the Access Level in the Access to Send Email section is set to All email. Click Save if you’ve made any changes.