Create an email notification for every time a DC Job is completed

Last published at: September 3rd, 2024
Delete

Follow the steps below to set up email notifications to be sent every time a DC Job is completed.

1. Create Email Template

First, create a template for the notification email that you will receive every time a DC Job is successfully completed.

  1. Go to Salesforce Setup > Email > Classic Email Templates.
  2. Click New Template .
  3. In Step 1, select Text and click Next.
  4. In Step 2, enter the following:
    Folder: select a folder to store the template, e.g. “Unfiled Public Classic Email Templates”.
    Available for Use: enable
    Email Template Name: “Duplicate Check Job Completed”
    Encoding: select a text format encoding, e.g. “General US & Western Europe”
    Description: “Duplicate Check Job email notification”
    Subject: enter a subject line for the email message
    Email Body: enter an email body text in the HTML Value field. Use merge fields to customize the mail and provide more details to the reader.
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.

To review the results, go to the DC Job Overview and click “View Results”.
  1. Click Save.

2. Create a workflow rule

  1. Go to Salesforce Setup > Workflow Rules. 
  2. Click New Rule .
  3.  In step 1, at Object, select Duplicate Check Job and click Next
  4. At Edit Rule enter the following:
    Rule Name: "DC Job Email Notification"  
    Description: "Duplicate Check Job email notification workflow rule"    
  5. At Evaluation Criteria, select created, and any time it's edited to subsequently meet criteria.  
  6. At Rule Criteria map the following: 

    Run this rule if the: criteria are met 

    Field 1: “Duplicate Check Job: Ended”   
    Operator: “not equal to” 
    Value: (leave empty) 

    Field 2: “Duplicate Check Job: Type” 
    Operator: “equals” 
    Value: “search” 
       
  7. Click Save or Save & Next.
  8. At "Specify Workflow Actions", click Add Workflow Action and select “New Email Alert”. 
  9.  At "New Email Alert", enter the following: 
    Description: “Duplicate Check Job Email Notification” 
    Email Template: switch to Lightning and Public Email Templates, and select the template you created in step 1: "Duplicate Check Job Completed"   
     Protected Component: leave unchecked   
      
    Recipients: Move the user that should receive the email notification to the Selected Recipients column. If needed, add more email addresses in the "Additional Emails" field.
  10. Click Save and then Done.  
    You will be redirected to the Workflow rule overview page 
  11. At the newly added Workflow Rule, click Activate.

Now, each time a DC Job is finished, you will receive an email notification. This applies to individual runs of Scheduled Jobs as well.