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
codewordcodeword 

How to pull owner field in VF email template?

I'm having trouble pulling the Opportunity Owner field in a custom VF template I created.

 

If I use the simple text/html template, I can use:

 

{!Opportunity.OwnerFullName}

{!Opportunity.OwnerFirstName}

{!Opportunity.OwnerLastName}

 

and all three work fine.  

 

BUT

 

in the VF template, I have a header:

 

<messaging:emailTemplate subject="New Win Announcement - {!relatedTo.Account.Name}" recipientType="User" relatedToType="Opportunity">
<messaging:htmlEmailBody >

 ................

 

and if I try to use {!relatedTo.OwnerFullName}, {!relatedTo.OwnerFirstName}, or {!relatedTo.OwnerLastName} ....it gives me a save error saying:

 


Error: Invalid field OwnerFirstName for SObject Opportunity

 

 

 

Is there a work around for this?  Or do you know if I'm doing anything wrong?   Any help is appreciated.  Thanks!

 

TehNrdTehNrd

Perhaps this...

 

 

{!relatedTo.Owner.Name}