function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kevin Carotherskevin Carothers 

How to get the approver name into an HTML email?

Hi everyone,

This should be pretty easy but it's giving me bouts of grief.

I need to get the name of the person that approved a record into an HTML email template, as there are several possible approvers and they would all like to know who approved the record from an email sent on final approval/rejection, rather than logging into Salesforce (for various reasons - they'd like to know via email).

I tried using the LastModifiedBy name, which seems to be correct when I look at an approved record in the UI, but when I insert it in my email template as a field, it's blank when the approval/rejection takes place, and the email is sent- 

Any ideas on how I can accomplish this?

Thanks in advance.

 
bakul.patelbakul.patel
Hi Kevin,
Why don't you store the name of the user in a field (Approver Name) using workflow? The workflow should be fired when the record gets approved.
And then you can use that field in your email template.

Regds,
Bakul
kevin Carotherskevin Carothers
Hi Bakul,

Thanks for the reply.

If I'm reading you right, That would work on an approval from the UI (Items toApprove section) by looking up the user from the $User object on the email template.

But AFAIK  there is no "User" available as an email approver in approval/rejection actions.
 
Just to clarify again, I have a use case where there are several email approvers, and on the final approval/reject actions, I need to know which of the approvers did the approval/reject and send a final email to all of the list of possible apparovers saying "XXXXX" approved (or rejected) the record.

Obviously the email templates for approval/rejected would be differen
PoornaPrabhu SeenivasanPoornaPrabhu Seenivasan
Hello Kevin,

You can add {!ApprovalRequest.Process_Approver} field to the email templates at each of the approval steps to know which of the several assigned approvers have approved/rejected the record at that particular step.

For getting a list all the approvers who has approved the record, you may have to write a custom trigger to save the step approvers at each of the steps whenever the record gets approved. And then, in the final approval action, you can list all those fields in the email template. Hope this helps. Thanks.