Workflow is one of the most powerful tools available in Salesforce. It helps to automate various business processes. Workflow allows you to Update a filed, Create a task, send an Email-Alert and Outbound message based on some criteria. In this article, we will see the step-by-step procedure to configure a workflow to send an email alert.
Business Scenarios when to use Workflows
Consider a business scenario in which an opportunity has different stages like Prospecting, Qualification, Needs Analysis, Value Proposition, Closed Won etc. The requirement is when an opportunity is updated to “Closed Won” status, an email should be sent to owner of the Account for which the Opportunity is create.
Steps for defining a workflow in Salesforce CRM
Below are the 3 simple steps to be followed to send an “Email alert using workflow”.
- Creating an Email Template.
- Creating an Email Alert.
- Creating a Workflow.
#Step 1: Creating an Email Template
Below are the steps to Create Email Template
- Navigate to Setup->Communication Templates->Classic Email Templates
- Click on “New Template” button. Below screen will be shown
- Choose the type of the template you would like to create. Here I’m selecting “Text” email template.
- Click on “Next” button. You will be redirected to the following page.
Select Folder as “My Personal Email Templates” if you want the Email template available only for your account. If you want to make it available for all users in your company then select “Unfiled Public Email Templates”.
- Select the “Available for Use” Check box to make it available for use.
- Choose the Template Name. Here I’m using “Email when Opportunity is Closed Won” as template name.
- Select your time zone as “Encoding”.
- Enter a description, subject and Email Body for your Email Template as shown below.
- Email body contains the content that you want to send as alert. Salesforce also provides you merged fields to use in the Email body. In the above figure “{!Opportunity.Name}, {!Account.Name} and {!Opportunity. Link}” are the merged fields used in the body to get opportunity Name, Account name related to opportunity and Opportunity record link. You can get this merged fields in “Available Merge Fields” section as shown in below figure.
- Select the “Field type”. I’ve selected “Opportunity Fields”.
- Select the field you want to use from the drop-down list. I’ve selected “Opportunity Name”.
- Copy the merge field value and use in the “Email Body”.
- Click on “Save” button. The template is ready to use. Now we’ll create Email Alert for this template.
#Step 2: Creating an Email Alert
Below are the steps to create Email Alert
- Navigate to Setup->Build->Create->Workflow & Approvals-> Email Alerts
- Click on “New Email Alert” button. You will be redirected to the following page.
- Enter all the required fields.
- Select Object from the drop-down list. As we are creating an alert for opportunity object I’ve selected “Opportunity” from the drop-down list.
- Select the Email template from lookup field. I’ve selected “Email when Opportunity is Closed Won” created in Step 1.
- Select the recipient to whom you want to send an Email Alert. Our requirement is to send an Email alert to Opportunities Account owner. Select “Account Owner” from “Recipient Type” and add the recipient from “Available Recipients” to “Selected Recipients” as shown below.
- You can also add 5 “Additional Emails” if required.
- Click on “Save” button. Now we’ll create a workflow to trigger this Email alert.
#Step 3: Creating a Workflow
Following are the steps to create a workflow
- Navigate to Setup->Build->Create->Workflow & Approvals->Workflow Rules.
- Click on “New Rule” and select the Object as shown below. Here I’ve selected “Opportunity” object.
- Click on “Next” button.
- Enter all the required fields as shown below.
- Select “created, and every time it’s edited” as Evaluation Criteria
- Our requirement is to send an email alert when an Opportunity is “Closed-Won”. Select “Opportunity: Stage equals Closed Won” as Rule criteria.
- Click on “Save & next”. You will be redirected to the following page.
- “Select Existing Action” from “Add Workflow Action” drop-down list. The following screen will be shown.
- Choose “Action Type” as “Email Alert” and select the “Email when Opportunity is Closed Won” from “Available Actions” and click on “save”. You will be redirected to the following page.
- Click on “Done”. Below screen will be shown.
- Click on “Activate” button to activate the workflow.
We have successfully configured the workflow to send an email alert. Now we will test the workflow by marking an Opportunity as “Closed-Won”.
- Mark an Opportunity to “closed-Won” to trigger an email alert. Here Opportunity with Name “TEST12JUNE18” related to Account “TEST12June2018” is marked as “Closed Won”.
- Click on “OK” and “Save” the record. Below is the Email Alert triggered for this opportunity.
In this way, you can configure an Email alert using workflow.
How we can help
Our team can help you customize and integrated Salesforce as per your business process. Read about our Salesforce Integration Services. Reach out to us for a free assessment of your business needs.