+ Start a Discussion
MyGodItsColdMyGodItsCold 

How do I reference lookup field in Email Template

I'm working through the "Creating On-Demand Applications:..." document. On page 174, there's an example of an Email Template. I want to do an email on Job Application, when an offer is extended. I'm trying to say to whom the offer has been made:

{!Job_Application__c.Candidate__r.FirstName__c}

does not work, but I see the value when I use SalesForce Explorer. I do get an email when I change the status of the Job Application, but there's no entry for the above. Even when I change it to {!Job_Application__c.Candidate__c.FirstName__c} expecting to get an error, it's blank. I

'm sure it's an obvious mistake, just too close to Thanksgiving.

tia,

MyGodItsColdMyGodItsCold
I was hoping that using First_Name (the real field name), would have solved the problem. It didn't.
Rasmus MenckeRasmus Mencke
How are you sending the email?
If you are using the email API you would have to pass in the related object id in this case the job application object
MyGodItsColdMyGodItsCold
I am sending the email by changing the status of the Job Application object to "Extend an Offer". Since there is a Workflow Rule which is activated by status taking on that value, and the associated Workflow Action is Email, the Email Template is used to send the email. Inside the chosen Email Template, I have the following:

{!Job_Application__c.Name}

Which is working fine - it shows (for example), JA-00001

But when I use the following entry:

{!Job_Application__c.Candidate__r.Last_Name__c}

I get nothing.

When I use Sforce Explorer to report on that object, and to request the Job_Application__c.Candidate__r.Last_Name__c field, I get the values I'm expecting.

Again, I'm modelling my experiment after what's in the "Creating On Demand Applications" pdf, page 174.

Does this help?
BWagsBWags

Did you ever get a solution to this problem?

I too am trying to do basically the same thing, access a parent in a relationship from an email template used in the child object.

Please post the solution if you figured it out.

dcwdcw

Anyone?  I'm sending an email based on an update to a custom object.  The custom object contains a lookup to the Product and I am trying to include some of the Product fields in the email.