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 8 years, 10 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

    application solution

    Popular Salesforce Blogs

    Lightning Aura Component

    How to Upload and Show Images in Lightning Aura Component | Salesforce Developer Guide

    Blog in Lightning

    In order to upload an image, you have two ways either use a standard file:upload or create a custom image file upload. Using the standard…

    Automatically Upload, Component, Controller, Custom Image File Upload, Data Table
    krati vishnoi Mar 12, 2021
    20,283  Views
    Learn Salesforce Einstein – Chapter 4 (How to check API Usage)

    Learn Salesforce Einstein – Chapter 4 (How to check API Usage)

    Blog in AI and ML, Salesforce Einstein

    How to check API Usage You can see this page if you have uploaded the key using these steps. You see below sections here: 1. API…

    Learn Einstein, Salesforce Einstein, Salesforce Einstein Language
    0to1Code.Com Sep 14, 2017
    4,966  Views

    Difference between a Salesforce Admin & Developer

    Blog in Salesforce Admin

    In the fast paced world of customer relationship management (CRM) Salesforce stands as a robust platform. Its robust platform empowers organizations to manage relationships &…

    Difference, Salesforce Admin, salesforcedeveloper
    Eden Aug 1, 2025
    105  Views

    Popular Salesforce Videos

    Prepopulate Field values in Salesforce Lightning Experience Using defaultFieldValues

    Prepopulate Field values in Salesforce Lightning Experience Using defaultFieldValues

    Video in Lightning

    Prepopulate Field values in Lightning Experience Using defaultFieldValues - Spring 20 This video demonstrates the following items: Set Record Type Id Using defaultFieldValues Enforce User…

    Salesforce Training, Salesforce Tutorial, Salesforce Lightning, salesforce, Field Values
    Abhishek Jun 2, 2021
    1,700  Views
    Coronavirus Impact On Healthcare Sector – Time To Rejuvenate | Salesforce CRM

    Coronavirus Impact On Healthcare Sector – Time To Rejuvenate | Salesforce CRM

    Video in Salesforce Products

    The Covid 19 has created an economic recession in the healthcare industry with disruption in healthcare services. The global healthcare CRM market is likely to…

    Salesforce Training, Salesforce Service Cloud, Salesforce Consultant, Salesforce Marketing Cloud, Salesforce CRM
    Kcloud Dec 23, 2020
    1,716  Views
    The Story of Salesforce. How Marc Benioff Built The Best CRM

    The Story of Salesforce. How Marc Benioff Built The Best CRM

    Video in Salesforce Stories

    This video, How It Happened explains the story of how Salesforce went from a small startup in San Francisco to become the leading CRM provider.…

    Salesforce Training, Salesforce Tutorial, salesforce, CRM, salesforce services
    Mayra Sep 9, 2022
    1,830  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

    © 2025 - 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.