I need to access value of contact email in email template using case object.'ContactEmail' is a standard case field is alredy availble, I am not able to see this field in case merge fileds.

Even if I write it manually, it is not working.


You will need to use {!Contact.Email} as the merge field. Email templates on some standard objects (like Case) have implicit access to the Contact lookup fields via {Contact.xxx} merge field syntax.

Here's an example of three ways to get at the Case's Contact Email and the corresponding rendered results:

Case.ContactEmail: {!Case.ContactEmail}

Case.Contact.Email: {!Case.Contact} // you can't even save the expression {!Case.Contact.Email}, 
                                       save coerces it to {!Case.Contact}

Contact.Email : {!Contact.Email}


Case.ContactEmail:  // nothing!

Case.Contact.Email: Foo Bar // returns Contact's Name!

Contact.Email : foo.bar@fubar.com  // email as desired
|improve this answer|||||
  • The Email gets trigger on creation of case, so I need to refer the case object in email template. Need to use contact email by using case object only. – Shilpa May 15 '19 at 7:39
  • @Shilpa my point is that email template where Case is the target object can still use Contact merge fields as behind the scenes, SFDC binds to both the Case standard controller AND the Contact standard controller – cropredy May 15 '19 at 13:56
  • It is HTML email template not the VF template. – Shilpa May 15 '19 at 13:57

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.