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

    Understanding Salesforce Clouds: A Simple Guide

    Blog in Salesforce

      Picture this: You’ve started a cool side hustle with your friends, maybe selling customized sneakers or running an online store for gadgets. Now, as…

    Elastik Aug 1, 2025
    330  Views

    Why Salesforce Implementations Fail and How Business Assessment Can Help You Achieve Success

    Blog in Salesforce Implementation

    The saying “no pain, no gain” came up a long time ago, but it seems like it was something that goes well for Salesforce implementations…

    Architecture, Business, Business Assessment, Business Capabilities, Business Goals
    360 Degree Apr 18, 2022
    2,371  Views
    What are Email Services In Salesforce? The Ultimate Guide

    What are Email Services In Salesforce? | The Ultimate Guide

    Blog in Others

    Email services in Salesforce are also used for other purposes beyond email-to-case, such as processing inbound emails for custom objects, scheduling outbound email messages, and…

    Attached CSV Files, Attachment, Attachments in Salesforce, Automated Process Service, Business Requirement
    Mohit Kumar Apr 3, 2023
    2,198  Views

    Popular Salesforce Videos

    Skill Based Routing with Apex/Flows in Salesforce

    Skill Based Routing with Apex/Flows in Salesforce

    Video in Salesforce Apex

    This video is the sequel to the omnichannel Salesforce tutorial (LINK) In this video, we will cover: 1. What is Skill-based routing 2. Why is…

    Salesforce Training, Salesforce Tutorial, Apex Class, Salesforce Video, Salesforce Learning
    Pooja Oct 7, 2021
    3,749  Views
    Man Free Climbs 1,070-foot Salesforce Tower in San Francisco

    Man Free Climbs 1,070-foot Salesforce Tower in San Francisco

    Video in Salesforce Stories

    A man free climbed San Francisco's Salesforce Tower Tuesday morning in response to the leaked draft in the Supreme Court Roe v. Wade abortion case.…

    salesforce, Salesforce Tower, Salesforce Video, Salesforce Learning, San Francisco
    Vivek May 6, 2022
    1,598  Views
    Get Started with Salesforce Commerce Cloud Einstein Product Recommendations

    Get Started with Salesforce Commerce Cloud Einstein Product Recommendations

    Video in Salesforce Cloud Platform

    Personalize the shopping experience for your customers with Commerce Cloud Einstein Product Recommendations. Drive conversions, enhance product visibility and increase revenue per visit with AI-driven…

    Salesforce Training, Salesforce Einstein, Salesforce Commerce Cloud, Salesforce Video, Testing
    Abhishek May 13, 2021
    4,716  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.