1

I'm trying to fetch the custom objects record details and display on the VF page with below code.

In my case, I have case lookup with a custom object (say, Evaluation__c) and my requirement is - open a case on a VF page and display details of Evaluation__c object record below.

Am I missing something? Pls guide.

Image illustration below: enter image description here

Code below:

            <apex:pageBlockSectionItem>
                <apex:outputLabel value="Case Number" />
                <apex:inputField value="{!Evaluation__c.Case__c} " id="Case__c" label="Case Number" required="false" />
            </apex:pageBlockSectionItem>


        </apex:pageBlockSection>
        <apex:pageBlockButtons>
            <apex:commandButton value="Submit" action="{!save}" />
        </apex:pageBlockButtons>
    </apex:pageBlock>

    <apex:pageBlock>

        <apex:pageBlockSection>
            <apex:pageBlockTable value="{! Evaluation__c }" var="e">
                <apex:column value="{! e.Case__c }" />
                <apex:column value="{! e.EvaluationNumber__c }" />
                <apex:column value="{! e.Max_Points__c }" />
                <apex:column value="{! e.Score__c }" />
            </apex:pageBlockTable>
        </apex:pageBlockSection>

    </apex:pageBlock>

</apex:form>

0

1 Answer 1

1

You would need a custom controller/extension which will implement search functionality. What you are doing is creating new record(while chcking submit,which is actually calling save) of evaluation, and thats what you see .

What you need to do is explained here. http://gtr.net/how-to-build-a-simple-search-page-using-visualforce/

4
  • Did. Still displays nil for rest 3 fields like above image post.
    – Viraj
    Commented May 19, 2016 at 4:20
  • It is because you are saving the Evaluation record,without this fields. CHeck the list view of evaluation, you will find plenty of Evaluation records with same case assigned. Commented May 19, 2016 at 4:26
  • This is particular case 1041 if you see has records exist.
    – Viraj
    Commented May 19, 2016 at 4:38
  • Evaluation object has Lookup of Case. What you are doing is Assigning Case to Evaluation and saving it. SO new Evalution records are created without other fields being populated. Commented May 19, 2016 at 4:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .