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 get a list of Sobjects in Javascript from the controller in salesforce?

    Tagged: Account, JS Controller, List, Salesforce Visualforce Page

    • Salesforce® Discussions

      How to get a list of Sobjects in Javascript from the controller in salesforce?

      Posted by Kumar on January 30, 2017 at 12:00 PM

      Hi all,

      I have list of accounts in my controller for a visualforce page. I want to directly use this list in my javascript on my page.

      How can I do this?

      Thanks

      sushant replied 9 years, 3 months ago 2 Members · 1 Reply
      • Account
      • JS Controller
      • List
      • Salesforce Visualforce Page
    • 1 Reply
    • sushant

      Member
      January 30, 2017 at 2:42 PM

      Hi Kumar,

      You can try the following code:

      <script>
      var jsAccounts= new Array();
      <apex:repeat value="{!accns}" var="accn">
      jsAccounts.push(accn);
      </apex:repeat>
      </script>

      Then your jsAccounts array will have the account values. Now you can just loop through the array and access the field. Just try console.log(jsAccounts) to see the content of the account array. Then you will understand who you should retrieve the values

      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

    [adinserter block="12"]

    Popular Salesforce Blogs

    Salesforce Flows

    Search Account Record Using Salesforce Flows | Learn Here

    Blog in Salesforce

    Go to Setup, enter flow in Quick Find then select Flows.  Click on New Flow. From the template, select Screen Flow.  If you are using…

    API Name, Custom Label, Error Message, First Record, Flow
    Aryan Ujlayan May 27, 2022
    5,221  Views
    Salesforce File

    How to Get Public Link for Salesforce File

    Blog in Salesforce

    Documents/reports which are appended in the record are put away as Salesforce File. Salesforce File is utilized to share and work together on transferred records,…

    Code to Produce, ContentDocumentLink, Document, documents, Public Connection
    krati vishnoi Dec 28, 2020
    9,049  Views

    How Integrated CRM Payment Solution can Help Nonprofits | Salesforce Solutions

    Blog in Salesforce integration

    If your fundraising team is spending hours monthly to manually import and export data from the increasing payment providers, then they are definitely doing it…

    Automatic Payment, cryptocurrency, Data Management, Data Transfer, Digital Donor Experience
    360 Degree May 11, 2022
    2,069  Views

    Popular Salesforce Videos

    Salesforce TrailheaDX '18 Opening Keynote - Part 1: Create Connected Customer Experiences

    Salesforce TrailheaDX '18 Opening Keynote - Part 1: Create Connected Customer Experiences

    Video in Trailhead

    TrailheaDX ’18 Opening Keynote – Part 2: Salesforce Platform TrailheaDX ’18 Opening Keynote – Part 3: Connect Every Experience Salesforce TrailheaDX ’18 Opening Keynote –…

    Salesforce Lightning, How To Learn Trailhead, Salesforce Trailhead, Customer Success, Lightning Components
    Abhay Mar 29, 2018
    1,487  Views
    Top 3 Reasons to Use Salesforce Checkout

    Top 3 Reasons to Use Salesforce Checkout

    Video in Salesforce Products

    Watch this video to understand your Salesforce contract information, make payments, and add additional licenses with Salesforce Checkout. This video discusses about the top 3…

    Salesforce Training, salesforce, Salesforce Video, salesforce product, Salesforce Checkout
    Rupal Kakkar May 6, 2020
    1,473  Views
    How to Configure and Customize Salesforce Lightning

    How to Configure and Customize Salesforce Lightning

    Video in Lightning, Salesforce Training

    A Salesforce expert will guide you through all of the configuration, customization, and personalization options available so you can get the most out of Lightning…

    Salesforce Training, Salesforce Lightning, salesforce, Sales Productivity, Salesforce Lightning App
    Prafull Jul 20, 2021
    2,301  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.