You need to sign in to do that
Don't have an account?

Apex component unknown property error
I'm using the online Visualforce documentation to try to learn how to render a visualforce component as a PDF attachment on a visualforce email. But, when I try creating a component exactly like the one in the documentation I get an error. Am I missing something or is there a mistake in the documentation??
Here's the code I can't get to work (gray box below). When I copy and paste it into a new visualforce component, it won't save and gives me this error message: Error: Unknown property 'account'
Defining a Custom Component as an Attachment
By creating a custom component and using it on the Visualforce email form and to render the PDF for the email, users can see a preview of the content they are trying to send.
<apex:component access="global"> <h1>Account Details</h1> <apex:panelGrid columns="2"> <apex:outputLabel for="Name" value="Name"/> <apex:outputText id="Name" value="{!account.Name}"/> <apex:outputLabel for="Owner" value="Account Owner"/> <apex:outputText id="Owner" value="{!account.Owner.Name}"/> <apex:outputLabel for="AnnualRevenue" value="Annual Revenue"/> <apex:outputText id="AnnualRevenue" value="{0,number,currency}"> <apex:param value="{!account.AnnualRevenue}"/> </apex:outputText> <apex:outputLabel for="NumberOfEmployees" value="Employees"/> <apex:outputText id="NumberOfEmployees" value="{!account.NumberOfEmployees}"/> </apex:panelGrid> </apex:component>
After coming back to this and getting hung up on it again 2 months later, I thought I should record here what the correction is that needs to be made in order for the code in the Create An Email Attachment documentation to work correctly. I'll report this to SF as well.
The "attachment" component needs to have an attribute tag added to it to receive an Account Object that you will pass to it from the "attachmentPDF" visualforce page defined earlier in the documentation.
Then, the attachmentPDF visualforce page has to be modified to pass the Account object.
All Answers
There is a mistake in the documentation. If the component wishes to reference an Account object, it has to be passed to it as an attribute (or obtained via a controller)
Thanks so much aballard! I was starting to feel very inept! Glad to know it wasn't me.
After coming back to this and getting hung up on it again 2 months later, I thought I should record here what the correction is that needs to be made in order for the code in the Create An Email Attachment documentation to work correctly. I'll report this to SF as well.
The "attachment" component needs to have an attribute tag added to it to receive an Account Object that you will pass to it from the "attachmentPDF" visualforce page defined earlier in the documentation.
Then, the attachmentPDF visualforce page has to be modified to pass the Account object.
Thanks, thunksalot for coming back on your post and correcting, for starter this helps a lot.