Thursday, 29 September 2016

Changing the Approval Assignment Email Template dynamically within Approval Processes

Changing the Approval Assignment Email Template dynamically within Approval Processes

Approval Processes in Salesforce are a great Administrator resource. They allow you to dynamically route an Account, Opportunity, or any Custom Object through for Approval from One or Many people. 

Approval Steps can create Tasks, send Emails, and perform Field Updates on your records as they move through the process.

If you haven't used them before, I'd recommend you check out the Salesforce Trailhead module on Automation.


The Problem

You can have multiple steps in an Approval Process - for example, 
You first request approval from Person A, then Person A's Manager, then Person A's Manager's Manager (and so on). 
You can control what happens if one person Approves/Rejects the record at any stage. 

However, the challenge I had the other day is that the "Approval Email Notification Template" for each Approval Stage is the same.

The Solution

To address this, I created a standard "Approval Assignment Email Template" that had 3 placeholders in place for the Subject Line, the Introduction, and the Request. 

Then, on the Object I was working on I created 3 new fields called:
  • Email Subject
  • Email Introduction
  • Email Request
At each stage of the Approval Process, I used Field Updates to tweak the email greeting and introduction for the next time the Approval Request was sent out.

Each Approval Step includes Field Updates to amend the Approval Request at the nex stage
This was an easy fix that allowed me to keep a single email template whilst still personalising it at each stage. 

Icon from Iconfinder, artist Bartłomiej Jacak