You need to sign in to do that
Don't have an account?
Mail Merge fields error in VF page
I have setup a custom object invoice and am trying to insert mail merge fields in the visual force page which is called when users click on Print Preview custom button. However when I enter mail merge fields from my custom object I am getting errors that fields do not exist. Here's my code thus far:
the error is: Error: Field $Invoice__c.Invoice_type does not exist. Check spelling.
<apex:page standardController="Invoice__c" standardStylesheets="true" showHeader="false" sidebar="false" tabStyle="Invoice__c"> <table width="110%" border="0" cellpadding="0" cellspacing="0">
<tr><td><apex:image url="{!$Resource.ceridianLogo}" width="387" height="96" /></td>
<td align="right"><a href="javascript:window.print();">Print</a></td></tr>
</table> <apex:outputLabel value="Invoice number" for="InvoiceNumber"/> <apex:outputText id="InvoiceNumber2" value="{!$Invoice__c.Invoice_Number__c}"/> <apex:pageBlock title="invoice description"> <b>This is an invoice for <i>{!$User.FirstName}</i>.</b>
</apex:pageBlock> </apex:page>
My button was misconfigured that's why it did not pick up the record ID
All Answers
The $ in the name is incorrect.
If I don't use the $ it doesn't bring me the value (the number of the invoice) it only show the name of the field.
$ is not part of the name, except for some special system objects like $User. The syntax to include the field from your custom object should be
{!Invoice__c.Invoice_Number__c}
But as I said above if use this syntax I have only "Invoice Number" displayed and the actual number (which is autonumber) doesn't show up
That's coming, correclly, from the <apex:outputLabel> . Which shows it is correctly accessing the field. If you are not seeing a number, there problably isn't a value in the field. Autonumber won't have a value until the record has been saved.
it's not working with any of the fields from my custom object and there are values. It displays the field name but not the value. Any idea? IS there anything else I need to configure for my cuctom object to be used in VF? I am new to this and this so I might not have setup something properly.
Sounds like you don't have an object to diisplay. How are you loading the page? You need to specify the id of an existing object in the query parameter when you load the page.
The code pasted above is all I have so far. It's activated when a user clicks on a custom button. the page displays the user.firstname and my logo but nothing from the custom object invoice__c - I mean no values, just field labels
Also - I am doing this in my Sandbox - if that matters
My button was misconfigured that's why it did not pick up the record ID