How to create an email notification for every time a DC Job is completed

Last published at: 2021-12-21 13:24:10 UTC
Delete

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

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:

  1. Navigate to Salesforce Setup menu.
  2. In the search box, type "Email Template" and select "Classic Email Templates".
  3. Click the "New Template" button.
  4. At Step 1, select Text and click 'Next'.
  5. 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: 

  6. Click 'Save'

Step 2 Create a workflow rule

  1. Navigate to Salesforce Setup Menu
  2. In the search box type "workflow rules". Select the Workflow Rules page.
  3. Click the "New Rule" button.
  4.  In step 1, under Object, select "Duplicate Check Job" and click "Next"
  5. 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:

  6. Click "Save" 
  7. Now under "Workflow Actions" click the "Edit" button
  8. Under "Immediate Workflow Actions" click on the "Add Workflow Action" drop-down menu and choose "New Email Alert"
  9.  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.
  10. 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.
Delete

Now, every time after a job on the DC Job page is finished, you will receive an email notification. This applies to the all scheduled DC Jobs too.

Here is an example of the email notification: