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
snh_nitsnh_nit 

How to access recipientType in Visualforce Email Template?

Hi,

 

I'm building a Visualforce Email Template consisting of a component, custom controller and a Visualforce email template. See here for details: http://boards.developerforce.com/t5/Visualforce-Development/Visualforce-email-template-issue/m-p/440361/highlight/true#M50419

 

Now, I have everything working except for one little thing - and that is the recepientType.

 

For some reason, I cannot seem to access that field/value without getting an error back.

 

I've tried accessing the field like this: {!recipient.name} but then I'm told that there is no such variable in my controller (which is correct).

 

My assumption was then, that because I have a custom controller to go with the component, I would need to fetch the contact (recipientType) in the controller. However, when I passing recipientType to my controller my template stops working (I get the "list has no rows" error which I assume is a related issue but not the real one).

 

I've tried passing recipientType to my controller as {!recipient}, {!recipientType} and {!recipientType.Id}. None of which seem to be working for me.

 

Any clues?

 

/Søren Nødskov Hansen

Abhay AroraAbhay Arora
Did you try using {!relatedTo.Contacts__r} instead?
Somehow i feel  like in your remplate you are passing a parameter to the component and that is not working for you
 Try just using
<messaging:htmlEmailBody >
     {!relatedTo.Id}
</messaging:htmlEmailBody>
Instead of
<messaging:htmlEmailBody > <c:OrderFormDomainOppComponent paramOppId="{!relatedTo.Id}"/> </messaging:htmlEmailBody>
and if this works means the assignment to the component will be the problem which is paramOppId="{!relatedTo.Id}