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, 6 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

    7 Salesforce Challenges Businesses Face and How Experts Solve Them

    7 Salesforce Challenges Businesses Face During Growth and How Salesforce Experts Solve Them

    Blog in Salesforce

    Business growth brings new opportunities, but it also creates operational complexity. As companies expand into new markets, manage larger sales teams, and handle increasing customer…

    CRM Optimization, CRM Strategy, Salesforce Consulting, Salesforce Consulting Services, Salesforce CRM
    Shivam Sep 1, 2026
    168  Views

    Salesforce Nonprofit Cloud Spring '24 Highlights

    Blog in Salesforce Releases

    While many of us are still feeling the chill of winter, Salesforce's Spring '24 release is in full bloom! Let's review some of the Nonprofit…

    Business Process API, Campaign ROI, Development, Donation Installments, Donor Records
    DB Feb 26, 2024
    1,500  Views
    Salesforce Experts for CRM Optimization | 7 Warning Signs.

    7 Signs Your Business Needs Salesforce Experts for CRM Optimization and Growth

    Blog in Salesforce

    If your team is fighting the system instead of working through it, you likely need Salesforce experts for CRM optimization before the gap gets any…

    CRM Optimization, CRM ROI, Salesforce Automation, Salesforce Consulting Services, Salesforce CRM Optimization
    Shivam Sep 4, 2026
    171  Views

    Popular Salesforce Videos

    Salesforce Apex Rest API Integration | Salesforce Integration

    Salesforce Apex Rest API Integration | Salesforce Integration

    Video in Salesforce Integration

    As you know Salesforce is an online cloud solution, we might be required to integrate Salesforce with some other third party tool. We have released…

    Salesforce Apex, Salesforce Integration, Apex Rest API, Salesforce Rest API, Apex APIs
    Portia Jan 8, 2018
    2,166  Views
    What is Lookup Relationship in Salesforce?

    What is Lookup Relationship in Salesforce?

    Video in Salesforce Stories, Salesforce Training

    In this video, Shrey is not only teaching but also demonstrating to you "What is Lookup Relationship in Salesforce?". You will be learning: 1. How…

    Salesforce Training, Salesforce Administrator, Lookup Relationship In Salesforce, Salesforce Learning, Journey with Salesforce
    Jogender Sep 10, 2020
    1,875  Views
    What is Validation Rule in Salesforce?

    What is Validation Rule in Salesforce?

    Video in Salesforce Training

    Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. A…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Data, Salesforce Learning
    CRS Apr 12, 2022
    1,834  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.