Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • 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
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • 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
    • Marketplace
    • Advertise With Us
    • 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 7 years, 7 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

    • 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

    application solution

    Popular Salesforce Blogs

    Lightning Web Components

    Salesforce Lightning Web Components Open Source Version (OSS)

    Blog in Others, Salesforce

    Introduction Lightning Web Components Open Source is an enterprise-grade UI framework built on modern web standards using which you can build apps that can run…

    App Tool, Applications, Automatic Import, Build LWC, Code Completion
    Anuj Dec 1, 2020
    4,450  Views
    company in salesforce

    How To Set Up Your Company in Salesforce

    Blog in Salesforce

    Use the corporate Information page in Setup to trace what’s important about your company’s organization in Salesforce. you'll also manage your licenses and entitlements. This…

    App-and-profile Combinations, Business Needs, Company Information, Data Security, Einstein Features
    krati vishnoi Jul 23, 2020
    5,257  Views

    Top 10 Salesforce Consultants in the USA with AI Skills

    Blog in Salesforce

    Your CRM isn't just storing customer data anymore. It's predicting sales, automating workflows, and talking to customers through AI agents. But here's the thing: Salesforce…

    salesforcedeveloper
    Amit Nov 26, 2025
    75  Views

    Popular Salesforce Videos

    Salesforce Careers: Drive Success Through the Lens of the Customer

    Salesforce Careers: Drive Success Through the Lens of the Customer

    Video in Salesforce Stories

    Salesforce employs over half of the Technical Architects across the globe and is shaping the future! Visit careers at Salesforce to apply for the Professional…

    Nauman Jan 3, 2022
    1,597  Views
    Introduction to Set & Map in Salesforce || What is Set || What is Map ||

    Introduction to Set & Map in Salesforce || What is Set || What is Map ||

    Video in Others

    From Salesforce instructor, Become a Salesforce Expert. A brief introduction about what is a Set, map, and what are their importance? Check out the video to…

    Salesforce Expert, Set, Salesforce Map, Map
    Neha Yadav Oct 21, 2019
    2,103  Views
    How to Create a Connected App in Salesforce? | What is a Connected App?

    How to Create a Connected App in Salesforce? | What is a Connected App?

    Video in Salesforce Apps

    Watch this video to learn how to create a Salesforce connected app to enables an external application to integrate with Salesforce using APIs. If you…

    Salesforce Training, Salesforce Integration, salesforce, Salesforce Video, Salesforce Learning
    Pooja Jul 27, 2021
    2,082  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

    © 2025 - 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®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.