0

I am displaying record in table format using Visualforce but just titles are showing not records. what are my possible error.

Below is my code :::

<apex:page standardController="Patient__c">
    
    <apex:pageBlock title="Patient Records...!!!">
         <apex:pageBlockTable value="{!Patient__c}" var = "Pa" >
    
            <apex:column value = "{!Pa.Name}"/>
            <apex:column value = "{!Pa.Contact_Number__c}"/>
            <apex:column value = "{!Pa.Email__c}"/>
            <apex:column value = "{!Pa.Age__c}"/>
    
        </apex:pageBlockTable>
    </apex:pageBlock>  
</apex:page>

and Below is the output

Output

2
  • What is the url you're using to access this page? More to the point, are you including the Id of a Patient record in it?
    – Derek F
    Commented Feb 12, 2023 at 12:42
  • I am using this page on lightning app home page. Commented Feb 12, 2023 at 13:54

1 Answer 1

0
  • In your code you were directly accessing Patient__c and passing <apex:pageBlockTable as a value, a good practise would be adding a recordSetVar to <apex:page like a variable that holds the list of records to display and pass it to <apex:pageblockTable to use it.

  • When you specify a recordSetVar attribute in a Visualforce page, you can use it to access the records from the standard controller or the custom controller, and then display the data in a table or other data-bound components on the page

Try this below Code

<apex:page standardController="Patient__c" recordSetVar="Patients">

<apex:pageBlock title="Patient Records...!!!">
<apex:pageBlockTable value="{!Patients}" var = "Pa" >

    <apex:column value = "{!Pa.Name}"/>
    <apex:column value = "{!Pa.Contact_Number__c}"/>
    <apex:column value = "{!Pa.Email__c}"/>
    <apex:column value = "{!Pa.Age__c}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
5
  • Thanks But when i am adding this page to lightning home page i am getting bellow error "The 'Visualforce' component's 'Visualforce Page Name' property has an invalid value." Commented Feb 12, 2023 at 12:38
  • 1
    Code dumps make for poor answers. The explanation is as important as the solution itself.
    – Derek F
    Commented Feb 12, 2023 at 12:41
  • I apologise will change and add explanation
    – Aman Patil
    Commented Feb 12, 2023 at 14:35
  • This error message usually occurs when the value entered in the 'Visualforce Page Name' property of the Visualforce component is not a valid Visualforce page name in your org. To resolve this error, make sure you have created the Visualforce page and that the name you entered in the 'Visualforce Page Name' property matches the name of the Visualforce page exactly, including case sensitivity @SiddheshParatane
    – Aman Patil
    Commented Feb 12, 2023 at 14:37
  • Make Sure you follow this steps when you add VF page to lightning Home page winsurtech.com/blog/…
    – Aman Patil
    Commented Feb 12, 2023 at 14:52

You must log in to answer this question.

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