0

I created a WFR to email a Task's Owner when a new task is created. My problem is I can't pull in the Owner's name to the Email Template.

In Developer Console this SOQL query works: SELECT Id, Owner.Name, Subject FROM Task WHERE Id = '00T63000003qXbf'

When I create the Email Template I tried to use {!Owner.Name} and {!Task.Owner.Name} but only get blanks in the email. Any pointers what I'm doing wrong?

Thanks, Scott

3 Answers 3

2

You can use a VF email template:

<messaging:emailTemplate subject="Task Owner" recipientType="Contact" relatedToType="Task">
<messaging:plainTextEmailBody >
Owner name: {!relatedTo.Owner.name}
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

When you test this in the Send Test and Verify Merge Fields option of the Template Editor, you'll get:

Owner name: Fred Fubar
1

Salesforce didn't expose Owner related fields (in text based email templates, formula) in case of Task. Workaround could be create an Activity Custom field called Owner Name and update that field though trigger.

Use that custom field in the email template.

0

You can create a new Custom Field on the Activity sObject and use that field in the Email Template.

The custom field is just a text formula and can be something like Owner_Name__c = Owner:User.Full_Name__c, where Full_Name__c is a custom name field on User sObject, then in your Email Template, you can use something like {!Task.Owner_Name__c}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .