function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
manuel.garciamanuel.garcia 

Show fields of custom object in a table

Hi,

I just start working with salesforce.

After creating new custom object called regCall, that contains two fields: date and phone, i would want to know how can I set and get this information and after show in a table.

 

On the one hand, I want to set data to this object from one controller that handles the action of clicking one push button (that 'calls a phone number'). And in the other hand, in other page, I want to show a report with the list of regCalls inserted.

 

It would be very helpfully for me that anyone could help me, because this problem I cant solve is for one project development,

 

Regards,

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

Fetch the result in your apex class

 

public class listOfRegCall
{
    //getter
    public list<RegCall__c> getRegCalls()
    {
       return [Select Date__c, Phone__c From RegCall__c];
    }


}

 page

 

<apex:page controller="listOfRegCall">
<apex:form>

<apex:pageBlock>

  <apex:pageBlockTable value="{!RegCalls}" var="item">
       <apex:column value="{!item.Date__c}"/>
       <apex:column value="{!item.Phone__c}"/>
  </apex:pageBlockTable> 

</apex:pageBlock>
</apex:form>
</apex:page>

 

All Answers

NikuNiku

You can directly bind your regCall object to the page.

 

 in Controller 

public regCall objregCall {get;set;} 

 

and bind to the visual force page directly 

<apex:Page>

<apex:Inputfield value="{!objregCall.Date}"> </apex:Inputfield>

<apex:Inputfield value="{!objregCall.Phone}"> </apex:Inputfield>

<!-- Add your logic in the save method values are automatically get set. in the controller-->

 

</apex:Page>


Shashikant SharmaShashikant Sharma

Fetch the result in your apex class

 

public class listOfRegCall
{
    //getter
    public list<RegCall__c> getRegCalls()
    {
       return [Select Date__c, Phone__c From RegCall__c];
    }


}

 page

 

<apex:page controller="listOfRegCall">
<apex:form>

<apex:pageBlock>

  <apex:pageBlockTable value="{!RegCalls}" var="item">
       <apex:column value="{!item.Date__c}"/>
       <apex:column value="{!item.Phone__c}"/>
  </apex:pageBlockTable> 

</apex:pageBlock>
</apex:form>
</apex:page>

 

This was selected as the best answer
manuel.garciamanuel.garcia

Thx you guys,

It works. 

Shashikant SharmaShashikant Sharma

Your welcome manuel