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

    Automate Salesforce Data Import/Export Using Data Loader CLI

    Blog in Others

    One of the key facets of Salesforce is import and export data from salesforce. Data loader is a great tool provided by Salesforce to achieve…

    Command-line Interface, CRM, Data Loader, Salesforce, Salesforce Data
    Ravi Aug 3, 2016
    69,618  Views
    Salesforce Lightning customization - Related List Quick Links

    Salesforce Lightning customization - Related List Quick Links

    Blog in Lightning, Salesforce customization, Salesforce Implementation

    Related List Quick Links-  We are familiar with looking at any record in salesforce lightning. If you want to see all the related list record then you…

    Customize Related List, Features of Salesforce Lightning, Implement Salesforce Lightning, List in Salesforce, Record Related List
    Ajay Prakash Jan 15, 2018
    38,529  Views
    Flows and Plugins in Salesforce

    Learn All About Flows and Plugins in Salesforce | The Developer Guide

    Blog in Others, Salesforce, Salesforce Tools

    Flows When the process involves the number of pages when the data need to be transferred between the pages. We prefer to uses flows. Plugin…

    Built-in Interface, Business Logic, Captured Values, Create a Flow, data
    Kirandeep Jan 28, 2021
    4,455  Views

    Popular Salesforce Videos

    Learn DML Statements in Salesforce Development

    Learn DML Statements in Salesforce Development

    Video in Salesforce Training, Salesforce Development

    In this video, We'll be learning about DML (Data Manipulation Language) in Salesforce development: We will be discussing the following things in this video: 1.…

    Salesforce Training, Salesforce Development, Salesforce Video, Salesforce Learning, Salsforce
    Manpreet May 4, 2020
    2,876  Views
    We are the Salesforce Development Company you are looking for!

    We are the Salesforce Development Company you are looking for!

    Video in Salesforce Development

    From startups to enterprises, we help organizations make more out of their Salesforce CRM. We are end-to-end Salesforce development experts. And yes, we will redefine…

    Salesforce Training, Salesforce Development, salesforce, CRM, Salesforce Consulting
    Algoworks Aug 18, 2020
    1,317  Views
    How to use Einstein Engagement Scoring in Salesforce Marketing Cloud

    How to use Einstein Engagement Scoring in Salesforce Marketing Cloud

    Video in Marketing, Salesforce Cloud Platform, Salesforce Einstein

    Cameron Robert shows how to gain actionable insights from the Einstein Engagement Scoring Dashboard in Salesforce Marketing Cloud, and talks through a few activity ideas…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Einstein, Salesforce Marketing Cloud
    Cameron Sep 20, 2021
    3,452  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.