+ Start a Discussion
manjunath vivekmanjunath vivek 

How to display the field values of custom object in my scenario


I have two objects, contact(standard object) and Callrecord__c (custom object),Contact has lookup relationship with Callrecord__c,I would like to  display Call_Date__c field  which is in  custom object when we enter the phone number in inputfield and submit button is clicked.We should make sure Call_Date__c field should be related to the phone number that we enter in inputfield.My code is given below,iam not getting any error but the code is not displaying Call_Date__c field .
<apex:page Standardcontroller="Contact" extensions="Retrievefields" >

 <apex:form >
<apex:pageblock title="Callrecords" >
 <apex:inputText value="{!phnum}" />
 <apex:commandButton value="Submit" action="{!find}"/>
 <apex:pageBlock title="Search Result">
      <apex:pageblockTable value="{!CallList}" var="a">

      <apex:column value="{!a.Call_Date__c}"/>



public class Retrievefields{

     public Integer Phnum {get; set;}
  public List<Call_Record__c>  CallList {get; set;}

public Retrievefields(ApexPages.StandardController controller) {


public void find()
    string sql = 'SELECT Call_Date__c FROM Call_Record__c WHERE Donor__c.phone LIKE \'%'+Phnum+'%\' LIMIT 5 ';
    CallList = Database.query(sql);

Praful GadgePraful Gadge
Hi Manjunath,

You need to rerender the pageblck table after calling action from command button.
Please add id on pageBlock (line 9) as below:
<apex:pageBlock title="Search Result" id="pageBlock" >
Now, add this id on reRender attribute of command button (line 7) as follows:
<apex:commandButton value="Submit" action="{!find}" reRender="pbTable" />
Please try and let me know if you still face this issue.

If this post is your solution, kindly mark this as the solution to the post so that others may benefit.

Praful G.