I have a custom object named Proposal__c. It is a child of the Contact object.

I need to

  1. Display some contact fields like salutation, first name, last name in the first panel grid.

  2. Show field names next to the values in both grids. Right now the second grid only shows values.

  3. I need to use this page as a page layout instead of the standard layout as we need a 3 column display.

What do I need to add to get this done? Can someone explain what I need to do for #3?

Here is my attempt....

<apex:page standardController="Proposal__c">

    <apex:panelGrid columns="3" id="Personal_Information">
        <apex:outputText value="{!proposal__c.Contact__c.Salutation }" id="Salutation"/>


    <apex:panelGrid columns="3" id="Academic_Information">
        <apex:outputText value="{!proposal__c.Academic_Title__c}" id="AcademicTitle"/>
        <apex:outputText value="{!proposal__c.Last_Obtained_Degree__c}" id="Lastobtaineddegree"/>
        <apex:outputText value="{!proposal__c.Date_of_Last_Degree_Conferred__c}" id="Dateoflastdegreeconferred"/>
        <apex:outputText value="{!Proposal__c.Current_Affiliation__c}" id="CurrentAffiliation"/>
        <apex:outputText value="{!Proposal__c.University_Department__c}" id="UniversityDepartment"/>
        <apex:outputText value="{!Proposal__c.University_country__c}" id="Universitycountry"/>
        <apex:outputText value="{!Proposal__c.Secondary_University_Affiliation__c}" id="Secondary_University_Affiliation__c"/>
        <apex:outputText value="{!Proposal__c.Secondary_University_Department__c}" id="Secondary_University_Department__c"/>
        <apex:outputText value="{!Proposal__c.Secondary_University_Country__c}" id="Secondary_University_Country__c"/>
        <apex:outputText value="{!Proposal__c.Previous_Applicant__c}" id="Previous_Applicant__c"/>
        <apex:outputText value="{!Proposal__c.Previous_Application_Year__c}" id="Previous_Application_Year__c"/>
        <apex:outputText value="{!Proposal__c.Previous_Fellow__c}" id="Previous_Fellow__c"/>
        <apex:outputText value="{!Proposal__c.Previous_Fellow_Year__c}" id="Previous_Fellow_Year__c"/>
        <apex:outputText value="{!Proposal__c.Research_Sub_Discipline__c}" id="Research_Sub_Discipline__c"/>
        <apex:outputText value="{!Proposal__c.Year_of_retirment__c}" id="Year_of_retirment__c"/>        
  1. You can reference fields on the Contact by utilizing the same relationship notation you use in SOQL. Your relationship field is apparently called Contact__c, so you would reference Contact__r.FirstName, Contact__r.LastName, and so on and so forth. Note that you have to use __r for custom relationships; for standard relationships, you use the name of the field without Id as a suffix (e.g., Contact.Account.Name, not Contact.Account__r.Name or Contact.AccountId.Name).
  2. You can use the <apex:outputLabel> component to display labels explicitly, or use display components like <apex:outputField> within <apex:pageBlockSection>s to show labels automatically (in the same style as standard record pages). You can reference labels dynamically in your <apex:outputLabel> components rather than hard-coding them by using the $ObjectType Visualforce expression, as in {! $ObjectType.Account.Fields.Name.Label }.
  3. You can override the View action with a Visualforce page in the custom object's page in Setup, under Buttons, Links and Actions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.