Toggle Side Panel

  • Blogs
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How to show my account list on apex page at the time when we preview the page in Salesforce?

    Tagged: Account List, Apex Page, Salesforce Apex, Salesforce Customization

    • Salesforce® Discussions

      How to show my account list on apex page at the time when we preview the page in Salesforce?

      Posted by shariq on August 17, 2017 at 9:37 AM

      I want to show my account list at the time when the page loads(At the starting).

      shariq replied 8 years, 1 month ago 3 Members · 4 Replies
      • Account List
      • Apex Page
      • Salesforce Apex
      • Salesforce Customization
    • 4 Replies
    • Neha

      Member
      August 17, 2017 at 9:47 AM

      Hi Shariq,

      You can use recordSetVar to view the list and create a variable "var" in <apex:repeat> tag to acess the records. May this example helps you:

      <apex:page standardController="Account" recordSetVar="Accounts" >
      <apex:pageblock>
      <apex:repeat var="a" value="{!Accounts}" rendered="true" id="account_list">
      <li>
      <apex:outputLink value="/{!a.ID}" >
      <apex:outputText value="{!a.Name}"/>
      </apex:outputLink>
      </li>
      </apex:repeat>
      </apex:pageblock>
      </apex:page>

    • [adinserter block='9']
    • shariq

      Member
      August 17, 2017 at 11:03 AM

      Hi Neha,

      In your apex controller you have taken list in a constructor, I am taking list in a method, then how to show my list when the page loads.

    • Parul

      Member
      September 15, 2018 at 3:06 PM

      You can use recordSetVar and apex:repeat to view the list and variable “var” in <apex:repeat> tag to acess the records.

       

      <apex:repeat value="{!accs}" var="acc">
      <tr>
      <td><apex:outputText value="{!acc.Name}"/></td>
      <apex:repeat value="{!acc.Contacts}" var="cont">
      <td><apex:outputText value="{!cont.Name}"/></td>
      </apex:repeat>
      </tr>
      </apex:repeat>

       

      Thanks

    • shariq

      Member
      September 16, 2018 at 10:10 AM

      Hi Parul,

      Correct answer which I got online -

      public static List<Account> getListAcc(){

      List<Account >accList = new List<Account >();

      //Logic

      return accList;

      }

      Then use ListAcc on VF page.

      Thanks.

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    Popular Salesforce Blogs

    Salesforce QA Role on a Project: Features, Challenges, Tools

    Blog in Salesforce, Salesforce Career

    Sometimes the work of QA specialists remains in the background, so it may be considered optional in the development process. We talked to Twistellar's QAs…

    Applications, Automated Tests, Business Analyst, Custom Ffunctionality, Customers
    Twistellar Jun 21, 2022
    3,240  Views

    Salesforce Introduces New Lightning Web Components aka #LWC

    Blog in Salesforce customization, Salesforce Releases

    If you are in the Salesforce ecosystem you would have probably heard about the new release of Lightning Web Components from Salesforce buzzing around the…

    API, AURA, Aura Components, Base Lightning Components, Development
    Guha Dec 31, 2018
    6,617  Views
    Drag and Drop

    Drag and Drop Address Field on Google Map | Salesforce Help Guide

    Blog in Lightning

    Why we need Why we need this type of Address functionality - In the business there are lots of accounts (Person/Business account) and we need…

    Billing Address, Billing Address Information, Code, Creating a Layout, Drag and Drop
    Prafull Apr 7, 2021
    5,131  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.