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
Deanna Aaron 4Deanna Aaron 4 

How to create a visual force page that can be used to display the results of an SOQL query

Hi. I'm a Salesforce Admin that has never created a visualforce page before (so bare with me please). My supervisor asked me to create a visual force page that can be used to display the results of an SOQL query. What do I need to do to accomplish this? I sincerely appreciate your help!
Prasanthi_s1505Prasanthi_s1505
Hi Deanna, 
     Can you give brief ur requirement, I can try to help you.

Thanks,
Prasanthi
Suraj Tripathi 47Suraj Tripathi 47
Hi Deanna Aaron,
For this requirement, you have to work on 2 steps
Step1:- Create an apex class that retrieves records from a SOQL query
Step2:- Create a Visualforce page to display the results returned from this SOQL query

create Apex class from developer console and use the below code:-
public with sharing class TestDisplayQueryList{
public List<Account> Records {get; set;}
public TestDisplayQueryList(){
Records =
[select Name, AccountNumber, CleanStatus from Account where CleanStatus='Pending'];
}
}

create Visualforce Page from Developer console and use the below code:-
<apex:page controller="TestDisplayQueryList">
<apex:pageBlock title="My Content">
  <apex:pageBlockTable value="{!Records}" var="Record">
   <apex:column >
    <apex:facet name="header">Account Name</apex:facet>
    <apex:outputText value="{!Record.Name}"/>
   </apex:column>
   <apex:column >
    <apex:facet name="header">Account Number</apex:facet>
    <apex:outputText value="{!Record.AccountNumber}"/>
   </apex:column>
   <apex:column >
    <apex:facet name="header">Clean Status</apex:facet>
    <apex:outputText value="{!Record.CleanStatus}"/>
   </apex:column>
  </apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

Thanks and regards,
Suraj Tripathi 
Please Mark It As Best Answer If It Solves your issue.
Deanna Aaron 4Deanna Aaron 4
Suraj! I will certainly be marking as BEST answer. Where do I insert my SQL Query?
SELECT fferpcore__Account__c, fferpcore__CustomerReference__c, fferpcore__DocumentDate__c, fferpcore__DocumentStatus__c, Total_Invoice__c, ffaci__CongaEmailStatus__c, Id FROM fferpcore__BillingDocument__c WHERE fferpcore__DocumentStatus__c = 'Complete' AND TPx_Special_Invoice__c=FALSE AND fferpcore__DocumentType__c ='Invoice' AND ffaci__CongaEmailStatus__c != 'Sent' LIMIT 999