0

Is it possible to access the User details behind the Owner of a record.

I get the following error while creating VF email template.

Error Error: Invalid field LocalBranch__c for SObject Name

Screenshot

2 Answers 2

2

Since the case owner is polymorphic it is a little different.

I do not think you can directly use the syntax in the merge field in the template BUT

  1. Create a formula field on the Case with the following syntax:

{!Owner:User.LocalBranch__c}

  1. In the email template use the {!relatedTo.[FIELDNAMEFROMSTEP1]

https://help.salesforce.com/HTViewHelpDoc?id=fields_creating_cross_object_notes.htm

Owner references aren’t supported in Visualforce pages. For example, on a page with Case as a controller, you can’t include {!Case.Owner:User.FirstName}. However, you can include an existing spanning formula on a Visualforce page. For example, if you have a custom text formula MyFormula__c on a Case with value Owner:User.FirstName, you can include {!Case.MyFormula__c} on your Visualforce page.

5
  • Thank You. I want to build a generic solution for all of the email templates I have and creating formulas for all the objects is not a good approach. Oct 20, 2015 at 14:56
  • @NishantSinghPanwar - It may not be a good approach, but it is the only approach available to you at this point if the merge syntax does not work directly in the email template. Along with the component route. But I did not get that requirement for being reusable across many objects from your original question
    – Eric
    Oct 20, 2015 at 14:57
  • I agree with you. Also I'm trying to do this to find the workaround as I'm not able to access the recipient's user information. It would be really great if you can help me build a workaround solution which gives the user details of recipient. I believe it could be possible using VisualForce Component. Oct 20, 2015 at 15:00
  • Here is my first question. salesforce.stackexchange.com/questions/95116/…. I didn't wanted to go for VF template but I did as I thought we can use {!recepient.name} in the VF template but this also doesnt works. It is a Salesforce Known Issue. Check It here : success.salesforce.com/issues_view?id=a1p30000000SdBfAAK Oct 20, 2015 at 15:05
  • I've done a well research of my question and then posted to community. Oct 20, 2015 at 15:08
1

Not is posible access owner fields in a email template. You have 2 workaround to do that.

  1. Create a component to show owner info in the visualforce email template
  2. Create a formula field to show owner info in any email template
1
  • Thank You. I believe I need to go with the component approach as I need to find a generic solution for all of the email templates. Oct 20, 2015 at 14:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .