You need to sign in to do that
Don't have an account?
Michael Wood 24
Displaying Lookup Data as a name in visualforce
Hi Everyone,
I'm working on a pdf export for Opportunities using a Visualforce page. I am able to grab all the data I need but I can't figure out how to display my lookup data fields properly in the export.
Here is the instance of the lookup field being used:
It is pulling data from Contacts:
and in the export it displays as the ID and not the name:
I have tried using ".name" in my code: <apex:outputText value="{!Opportunity.Designer_Name__c.Name}"/>
but I get this error: Error: Unknown property 'String.Name'
Any help would be greatly appreciated, thank you!
I'm working on a pdf export for Opportunities using a Visualforce page. I am able to grab all the data I need but I can't figure out how to display my lookup data fields properly in the export.
Here is the instance of the lookup field being used:
It is pulling data from Contacts:
and in the export it displays as the ID and not the name:
I have tried using ".name" in my code: <apex:outputText value="{!Opportunity.Designer_Name__c.Name}"/>
but I get this error: Error: Unknown property 'String.Name'
Any help would be greatly appreciated, thank you!
Is it not working?
All Answers
By default the lookup field gives an id you need to fetch and then show it in the visualforce page.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
As used in the example in the above link can you try fetching them once in the controller and then using them in the visualforce page.
Similar error: https://developer.salesforce.com/forums/?id=906F000000098V1IAI
Is it not working?