Draft emails allow support agents who use Case Feed, write and save messages without having to send them immediately. It also allows us to implement approval processes so that messages can be reviewed by supervisors or senior agents before they’re sent to customers. Drafts are only supported if your administrator has enabled them, but there is no such option to send reminder notifications for Draft emails. Let’s start with a business use case
Business Use case :- Warren Mason is working as System administrator in Universal Container. Support agents from his organization are using email draft feature and want some enhancements. Many times they compose a new email on Case Feed and save it as a Draft. Later on they forget to send it, so they want a reminder notification (email) for Draft emails after 2hrs of its creation.
Solution of above business requirement
There are a few possible solutions for the above business scenario, but I’ll use Flow and Process Builder to solve the above business requirement. You can also use Apex Triggers to solve the above business use case. Before proceeding ahead, you have to understand EmailMessage objects in Salesforce. Follow the below instructions to create a Flow to solve the above business requirement
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open the Flow canvas for you. Now create few Text variables in the Flow VarT_CaseID, VarT_OwnerName and VarT_OwnerEmail to store the data.
3. Now we’ll create an email template using the Text Template. Navigate to the Resources tab and add one Text Template to create an e-mail template. Design it as per the business requirements. Please refer the following screenshot for more information
4. The next step is to use the Send Email static action to send out an e-mail to the owner. Navigate to the Palette tab and drag-and-drop the Send Email static actions onto the canvas. Please refer the following screenshot for more details
5. Finally your Flow will look like the following screenshot
Launch a Flow from Process Builder
Our next task is to create a Process Builder on the Email Message object to launch a Flow. To create a Process on the Email Message object, follow the below instructions
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder and click on the New button, Enter Name, API Name and then click on the Save button
2. The next step is to add entry criteria. For this click on Add Object, select EmailMessage object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button
3. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [EmailMessage].Status Equals Draft), also select the check-box Do you want to execute the actions only when specified changes are made to the record? and click on the Save button, as shown in the following screenshot
4. The next task is to set the time for schedule action. For this click on Set Schedule available under Scheduled actions. Set time for scheduled actions as shown in the following screenshot
5. Now we have to add a Time-based action into the Process to launch a Flow. Click on Add Action (Under Scheduled actions), Select the type of action to create (In our case Flows) , and then fill out the fields to define the action, as shown in the following screenshot
- VarT_CaseID = [EmailMessage].ParentId
- VarT_OwnerEmail =[EmailMessage].CreatedBy.Email
- VarT_OwnerName = [EmailMessage].CraetedBy.FirstName
5. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot
Don’t forget to active the Process by clicking on the Activate button.
It’s time to test this App
1. Now compose an email (By navigating case detail page) and save it as draft as shown in the following screenshot