Step 1 Create Email Template
First, you need to create the notification email template that you will receive every time a DC Job is successfully completed. Here is how:
- Navigate to Salesforce Setup menu.
- In the search box, type "Email Template" and select "Classic Email Templates".
- Click the "New Template" button.
- At Step 1, select Text and click 'Next'.
- Under Step 2 "Email Template Information" fill the following.
Folder: Choose where to store your email template, in this example, we choose "Unfiled Public Classic Email Templates"
Available for Use: Enabled
Email Template Name: Duplicate Check Job Completed
Template Unique Name: Duplicate _ Check _ Job _ Completed
Encoding: Choose your text format encoding. In this example, we choose the "General US & Western Europe" format
Description: Duplicate Check Job email notification.
Subject: Your Duplicate Check Job has been Completed (This is the email subject)
Email body:
Note: You can customize the email body in a way that you like.Hey, {!User.Name} The Duplicate Check Job you started at {!dupcheck__dcJob__c.CreatedDate} with job name {!dupcheck__dcJob__c.dupcheck__name__c} finished successfully with {!dupcheck__dcJob__c.dupcheck__duplicateCount__c} duplicate records found.
Screenshot example of the filled form: Click 'Save'
Step 2 Create a workflow rule
- Navigate to Salesforce Setup Menu
- In the search box type "workflow rules". Select the Workflow Rules page.
- Click the "New Rule" button.
- In step 1, under Object, select "Duplicate Check Job" and click "Next"
- Under Edit Rule fill the following:
"Rule Name" type "DC Job Email Notification"
For Description type: "Duplicate Check Job email notification workflow rule"
Under Evaluation Criteria choose "create, and any time it's edited or subsequently meet criteria"Under Rule Criteria map the following:
Rule this rule if the "criteria are met"
Field 1:
Duplicate Check Job: Ended
Operator: Not equal to
Value: *null (leave it empty/blank)Field 2:
Duplicate Check Job: Type
Operator: equals
Value: search
Screenshot example of the filled form: - Click "Save"
- Now under "Workflow Actions" click the "Edit" button
- Under "Immediate Workflow Actions" click on the "Add Workflow Action" drop-down menu and choose "New Email Alert"
- Under Description type: Duplicate Check Job Email Notification For "Email Template" choose the template you created in step 1: "Duplicate Check Job Completed"
Protected Component leave unchecked
For "Recipients" choose the users which will receive those email notifications. Select the user and click the arrow pointing right to add it. You can also add additional emails in the "Additional Emails" field. - Click "Save", after that click "Done". You will be redirected to the Workflow rule overview page again, now click the "Activate" button to active the workflow to start receiving emails when a Duplicate Check Job is completed.