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
darhdarh 

User merge field in workflow email alerts

I'm trying to use the {!User.___} merge fields to build a signature in HTML templates that are triggered by an email alert. However, the User is always me, even though the From address is set to the Default Workflow User. Here are all the settings (where I'm Mary and the desired User is Bob):

 

Default Workflow User (under Workflow & Approvals Settings): Bob

 

Workflow Rule:

  • Creator: Mary
  • Modifier: Mary
  • Object: Lead

Email Alert:

  • Creator: Mary
  • Modifier: Mary
  • From Email Address: Default Workflow User's email address

Email Template:

  • Creator: Mary
  • Author: Bob
  • Modified by: Bob
  • {!User.FirstName} becomes Mary
  • From and reply to fields become Bob

How on earth can I get Bob as the designated user?

Sonam_SFDCSonam_SFDC

Hi Drah,

 

I just tested this on my ORG and the signature in the email template is carrying the name/email address of the default workflow user.

 

When creating the email template I chose the merge fields from Sending User field type

 

I think the template is what that requires an update where you should use the above mentioned type. and choose {!User.Name} to get the name of the user who triggers the workflow.

 

Hope this helps!

darhdarh

That's not what I'm getting. {!User.Name} in the template is not the default workflow user.

 

Clearly we are doing something different, but I have no idea what.

darhdarh

I've run a bunch of tests. While the email From address is getting set to the Default Workflow User, the Sending User merge field is selecting the user who actually triggered the workflow. 

 

This sure looks like a bug in Salesforce. At best a huge inconsistency in behavior.

Tim BarsottiTim Barsotti

This is standard behavior. The user that starts the workflow is the user in context. Hence, the {!User.Name} returns the user that started the workflow. If you want to use the email address fields you should consider something like {!EmailMessage.FromName}

 

Hope this helps. 

darhdarh

Nice idea, but {!EmailMessage.FromName} doesn't resolve. Even if it did, the object does't contain fields like phone, title, fax, etc. 

 

There should be other ways to solve this: HTML text in footers of email letterhead, for example, but that simple feature does not exist. Yes, I could hard code it in the email templates, but then I'm looking at a future maintenance nightmare as there are a whole bunch of templates that need to reference the same signagure information.

Tim BarsottiTim Barsotti

When you say it "Didn't Resolve" is this in the preview or in the actual email you received? The preview makes sense. 

darhdarh

It was in the actual email.

Siva GundaSiva Gunda
I have a similar issue in Approval process.
A email template designed from 3 users to 3 Managers.
Example 1.HR 1. HR Manager
2. Financial Officer 2. Financial Approval Officer.

Work flow works well.
Depending on the user, manager is getting the emails.
now in the email Body, what should i mention in the To User Field.

Dear (Manager)

Please approve the following.

from
{!User.FirstName}

What should i use in the (Manager) to mention his name?
{!Receiving_User.Name}
{!Receiving_User.FirstName}{!Receiving_User.LastName}


I can directly use the custom object field {!GrantAward__c.FOName__c}
but i have multiple users to send. cant mention all the Managers fields in the template.