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

    Top Salesforce Trends To Watch Out In 2024

    Blog in Salesforce

    The cloud is a powerful tool that can help businesses grow exponentially. Top Salesforce CRM Trends in 2024 Let’s dig deeper into the current trends…

    AR Devices, Artificial Intelligence, Audience Segmentation, Augmented Reality, AWS
    Hennery cavil Dec 13, 2023
    1,519  Views

    What is the Einstein Prediction Builder in 2024?

    Blog in Others

    Artificial intelligence today simplifies decision-making by improving forecasts, automating tasks, saving time and money, and also making life easier. Using the capabilities of artificial intelligence…

    Artificial Intelligence, Automation, Contact Management, Customization, Data Analysis
    Vimera | Andersen Feb 21, 2024
    1,017  Views
    How to retrieve the list of users based on role hierarchy

    How to retrieve the list of users based on Role Hierarchy in Salesforce?

    Blog in Coding and Scripting, Salesforce Apex

    How to retrieve the list of users based on Role Hierarchy in Salesforce: Sometimes, you need a multilevel hierarchy i.e. you need to view the…

    Helper Class, Logged Users, Reports, Retrieve, role Hierarchy
    Parul Sep 11, 2018
    29,868  Views

    Popular Salesforce Videos

    Salesforce Heroku Integration | Heroku Connect

    Salesforce Heroku Integration | Heroku Connect

    Video in Salesforce Integration

    Heroku is a cloud platform that lets deploy, run and manage applications and websites. It is part of Salesforce Platform. This video will explain about…

    Salesforce Training, Salesforce Tutorial, salesforce platform, Salesforce Video, Salesforce Learning
    Jogender Jul 26, 2021
    4,800  Views
    Dreamforce To You 2020 - Algoworks

    Dreamforce To You 2020 - Algoworks

    Video in Salesforce Stories, Events

    The wait is over – Dreamforce will be going ahead in 2020! Salesforce has gone back to the drawing board and rebuilt Dreamforce 2020 for…

    Salesforce Integration, dreamforce, salesforce, Salesforce Event, Salesforce Video
    Algoworks Nov 5, 2020
    1,975  Views
    Winter'22 updates for Salesforce Developers

    Winter'22 updates for Salesforce Developers

    Video in Salesforce Training

    Did you know most new features are included with your initial purchase? Explore the latest innovations in the release to maximize your ROI from Salesforce.…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Developers, Salesforce Video
    Rupal Kakkar Oct 18, 2021
    1,910  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®.

    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.