+ Start a Discussion
GBGB 

Output displaying ID not name

Hi

Hopefully a simple one.  When I use this VisualForce page it returns the ID rather than the actual name value for Customer and Contact Role.  What have I missed?
 
<apex:page standardController="Project__c">
     <apex:pageBlock id="thePageBlock" >
        <apex:pageBlockSection title="Project Details" columns="1">
            <p>Name: {!Project__c.Customer__c}</p>
            <p>Contact Role: {!Project__c.Project_Contact_Role__c}</p>
            <p>Start Date: {!Project__c.Start_Date__c}</p>
            <p>End Date: {!Project__c.End_Date__c}</p>        
        </apex:pageBlockSection>
      </apex:pageBlock>
</apex:page>

 
Best Answer chosen by GB
Prabhat Kumar12Prabhat Kumar12
Try this.
 
<apex:page standardController="Project__c">
     <apex:pageBlock id="thePageBlock" >
        <apex:pageBlockSection title="Project Details" columns="1">
            <p>Name: {!Project__c.Customer__r.name}</p>
            <p>Contact Role: {!Project__c.Project_Contact_Role__r.Name}</p>
            <p>Start Date: {!Project__c.Start_Date__c}</p>
            <p>End Date: {!Project__c.End_Date__c}</p>        
        </apex:pageBlockSection>
      </apex:pageBlock>
</apex:page>

Let me know if it works for you.

All Answers

NagaNaga (Salesforce Developers) 
Hi Gb,

Please see the sample code below

Try this
<apex:outputText value="{!application.CreatedBy.name}"
style="font-size:11px;font-weight:bold;color="grey"/>

Uses the relationship to bring back the name

Best Regards
Naga kiran

 
Prabhat Kumar12Prabhat Kumar12
Try this.
 
<apex:page standardController="Project__c">
     <apex:pageBlock id="thePageBlock" >
        <apex:pageBlockSection title="Project Details" columns="1">
            <p>Name: {!Project__c.Customer__r.name}</p>
            <p>Contact Role: {!Project__c.Project_Contact_Role__r.Name}</p>
            <p>Start Date: {!Project__c.Start_Date__c}</p>
            <p>End Date: {!Project__c.End_Date__c}</p>        
        </apex:pageBlockSection>
      </apex:pageBlock>
</apex:page>

Let me know if it works for you.
This was selected as the best answer
GBGB
Thanks!