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

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
| improve this answer | |
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.