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
Tuur Dutoit 13Tuur Dutoit 13 

Unknown property 'UserStandardController.recipient'

I'm making a Visualforce email template, and I would like to pass the recipient (a User) to a custom component. Basically, I have the following setup (leaving out some unrelevant content).

Template:
<messaging:emailTemplate subject="..."
    recipientType="User"
    relatedToType="Some_Custom_Object__c">
  <messaging:htmlEmailBody >
    <c:Email recipient="{!recipient}">
      <p>Some content...</p>
    </c:Email>
  </messaging:htmlEmailBody>
</messaging:emailTemplate>

Custom component:
<apex:component access="global">
  <apex:attribute type="User" name="recipient" description="The user recieving this email" access="global" />
  <html>
      <head>
          <c:email_styles />
      </head>
      <body>
          <p>Dear {!recipient.Name},</p>
          <apex:componentBody />
      </body>
  </html>
</apex:component>

I saved the component successfully, but when saving the template, I get the following error: Unknown property 'UserStandardController.recipient'​.

Any ideas what might be causing this?
Best Answer chosen by Tuur Dutoit 13
Tuur Dutoit 13Tuur Dutoit 13
Naming the attribute in the component differently made the error go away:
<attribute name="r" type="User" description="..." />
<c:Email r="{!recipient}">...</c:Email>
Works like a charm! Weird bug, though.