0

I have a VisualForce email template that retrieves merge data from a custom object (Enquiry__c).

The owner is an individual User. I want to access the value of a custom field on the User object.

I'm able to access some standard fields (E.g., Email) of the owner by way of {!relatedTo.owner.Email}, but I'd like to access the values of custom fields.

Suppose I have a custom field called Acuity_Calendar_ID__c on the User object.

I try {!relatedTo.owner.Acuity_Calendar_ID__c}, but it doesn't work. I get the following Error:

Error: Invalid field Acuity_Calendar_ID__c for SObject Name 

Apparently, relatedTo.owner is a Name object. I guess these are the only fields I have access to?

I'm not the original author of the email template, nor am I a Salesforce developer. I'm just trying to add a sentence to an existing email template that I have.

3
  • Unfortunately you'll need a Visualforce Apex controller to retrieve any custom fields from the owner record. Sep 7, 2017 at 2:21
  • 1
    @DavidCheng Thanks for the suggestion, David! I ended up creating a custom formula field on the Enquiry object that returns the owner's Acuity Calendar ID. So I access it with relatedTo.Owner_Acuity_Calendar_ID__c
    – Matthew
    Sep 9, 2017 at 5:20
  • The issue is due to Owner being a polymorphic field for custom objects (queue or user).
    – cropredy
    Sep 9, 2017 at 22:56

0

You must log in to answer this question.

Browse other questions tagged .