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
Kiran NKiran N 

1. Create List of Account and display in the VF Page

I'm new to salesforce. Can someone help me with Creating List of Accounts and display in the VF Page without using SOQL. We need to use an Apex class without SOQL.
NagendraNagendra (Salesforce Developers) 
Hi Narsu,

May I request you please elaborate the requirement on why you don't want to use the SOQL query for displaying the list of accounts?

Also, I would suggest you please refer to the below link from the forums community with a similar discussion which might help you further. Happy to help further.

Thanks,
Nagendra
Ajay K DubediAjay K Dubedi
Hi Narsu,

Yes, you can simply do it using a standard controller. There is no need of displaying list using SOQL in case you are using standard controller in your page.
Standard controller provides direct accessibility to use Standard Objects as well as Custom Objects.
Please try the code below:

<apex:page standardController="Account" recordSetVar="Accounts">
    <apex:form>
        <apex:pageBlock title="Account List">
            <apex:dataList value="{!Accounts}" var="acc">
                <apex:outputText value="{!acc.Name}" />
            </apex:dataList>
        </apex:pageBlock> 
    </apex:form>
</apex:page>

 I hope this code will help you solve your query. Please mark it as best answer if you find it helpful.

Thanks.
Ajay Dubedi
Kiran NKiran N
Thanks for the response Ajay. IS there a way we can include an apex class too for this without SOQL.
Kiran NKiran N
Thanks for the response.Nagendra, this a task given when learning Salesforce and SOQL is not yet covered, thatz the reason I asked without using SOQL. I thought may be we should use apex class too and not just using Standard Controller.