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
JakesterJakester 

Get value from lookup on an email template

Hi All,

I have a Visualforce email template which is using relatedToType="Idea". On the Idea object, I have a custom lookup field called Rocker__c (don't ask :smileyvery-happy:) which is a lookup to the User object. I want to return the name from the User object. I've tried {!relatedTo.Rocker__c.FirstName} and it didn't work saying

Error: Unknown property 'String.FirstName'
What am I missing?

Thanks!

-Jake

JeremyKraybillJeremyKraybill
Use Rocker__r for relationship traversing. The "__c" value is just the Id of the looked up object. Also make sure your SOQL explicitly queries the related object's fields that you reference.

Jeremy Kraybill
Austin TX
JakesterJakester

That worked, thanks! I didn't need to do anything with SOQL using the email template - I just changed the "c" to an "r" in Rocker__r

-Jake