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 return and show the list of all Account Names using a Custom Controller in Salesforce?

    Tagged: Account List, Account List in Salesforce, Account Name, Custom Controller, Customization, Salesforce Customization

    • Salesforce® Discussions

      How to return and show the list of all Account Names using a Custom Controller in Salesforce?

      Posted by Raghav Chaturvedi on April 25, 2018 at 12:33 PM

      I have a button accountsName, I want when I click on the button, the list of all account name will return and show all account name using a custom controller

      Raghav Chaturvedi replied 8 years, 4 months ago 2 Members · 2 Replies
      • Account List
      • Account List in Salesforce
      • Account Name
      • Custom Controller
      • Customization
      • Salesforce Customization
    • 2 Replies
    • Aman

      Member
      April 25, 2018 at 5:05 PM

      Hi Raghav,

      Below is the code for apex controller :

      public class AccountNameDemo {
      Public List<Account> listOfAccounts{get;set;}
      public boolean showAccount{get;set;}

      public AccountNameDemo(){
      listOfAccounts = new List<Account>();
      showAccount = false;
      }

      public void AccountList(){
      listOfAccounts = [select id,name from Account limit 50000];
      showAccount = true;
      }

      }

      here is the code for visualforce page :

      <apex:page controller="AccountNameDemo">
      <apex:form>
      <apex:commandButton action="{!AccountList}" value="AccountsName" id="theButton"/>
      <apex:repeat value="{!listofAccounts}" var="acc" rendered="{!showAccount}">
      <apex:outputText value="{!acc.name}"></apex:outputText>
      <br/>
      </apex:repeat>
      </apex:form>

      </apex:page>

       

      below is the screen shot of output :

      Salesforce   Developer Edition

    • [adinserter block='9']
    • Raghav Chaturvedi

      Member
      April 26, 2018 at 11:23 AM

      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

    Steps in Salesforce

    Useful Salesforce Steps and Instructions

    Blog in Salesforce Implementation

    Hello All, Today I am going to provide you a very useful and important set of items that you should always keep handy with you…

    Apex Scheduler, Salesforce Apex, Salesforce Custom Fields, Salesforce Fields, Salesforce sObject
    PRANAV Feb 19, 2018
    5,668  Views
    Salesforce Lightning Bolt

    Salesforce Lightning Bolt: Create Gen-next Portals At Lightning Speed

    Blog in Lightning

    Ever since the launch of Community Cloud in the year 2013 it has received overwhelming responses from business ranging from small startups to big enterprises.…

    AppExchange, B2B e-commerce, Collaboration Platform, Community Cloud, CRM
    Algoworks Apr 28, 2020
    2,118  Views
    Salesforce Consulting Partner

    What Are The Benefits of A Salesforce Consulting Partner

    Blog in Salesforce Consultant, Salesforce customization, Salesforce Implementation

    Salesforce Consulting services help the organizations to fulfill their business needs by assisting them in projects like Salesforce implementation, data integration, customization, AppExchange, and many more.…

    AppExchange, Automated Processes, Best Tools, Business Flow, Certified Salesforce Company
    Micropyramid Aug 28, 2020
    5,813  Views

    Popular Salesforce Videos

    Salesforce Tutorial - How to Create Custom App in Salesforce

    Salesforce Tutorial - How to Create Custom App in Salesforce

    Video in Others, Salesforce Training, Salesforce Apps

    Apps, Tabs, Objects are basic Building Blocks of Salesforce. In this video, I am explaining how exactly you will able to develop a custom app…

    Salesforce Tutorial, Salesforce Development, salesforce, Salesforce Apps, Salesforce VIdeos
    Sam J May 26, 2020
    3,197  Views
    7 Lightning Flow Features in Salesforce Winter '20 Release

    7 Lightning Flow Features in Salesforce Winter '20 Release

    Video in Others, Lightning

    Lightning Flow Builder is an automation tool within salesforce.com CRM. It's declarative, clicks not code, a tool that can perform both fully automated and custom…

    Salesforce Lightning, salesforce platform, Salesforce VIdeos, Lightning Flow Builder, Cloud Designer
    Pooja Feb 27, 2020
    2,300  Views
    Slack "Work In Progress" Commercial | Where the Future Works | Success Anywhere | Salesforce

    Slack "Work In Progress" Commercial | Where the Future Works | Success Anywhere | Salesforce

    Video in Salesforce Stories

    We are HERE. The future? We made it! Maybe it's not quite what we envisioned, but here's the thing: the future is forward movement from…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, Slack
    Pooja Aug 18, 2021
    1,921  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.