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

    Salesforce Integration Architecture: Patterns and Best Practices

    Blog in Others

    Salesforce, while powerful on its own, often thrives when connected to other systems. This integration allows for seamless data flow, streamlined processes, and a unified…

    Cloudy Aug 1, 2025
    247  Views

    Enhance Your Cloud Security With Salesforce Shield

    Blog in Others, Salesforce, Salesforce Security

    Ever since Cloud came into play, Data security is the buzzword that reverberates all over the corporate world. It has been proven time and again that…

    API Object, Cloud Security, Data Security, Data Security In Cloud, Encryption Keys
    DemandBlue Apr 22, 2020
    3,099  Views
    Apex Triggers

    Learn About Apex Triggers in Salesforce & When to Use It

    Blog in Salesforce Apex

    Apex Triggers Apex triggers allow custom actions to be performed before or after data manipulation language (DML) events occur in Salesforce, such as insertions, updates,…

    Apex Triggers, Apex Triggers in Salesforce, API, API Call, Before Trigger
    Mohit Kumar Nov 23, 2022
    2,253  Views

    Popular Salesforce Videos

    Build Smarter Apps with Einstein Object Detection

    Build Smarter Apps with Einstein Object Detection

    Video in Salesforce Integration, Salesforce Einstein, Salesforce Implementation, Salesforce Apps

    Einstein Object Detection allows you to easily integrate advanced computer vision technology into your Salesforce workflows and external applications. Join us and learn how to…

    Salesforce Applications, Salesforce Apps, Salesforce Einstein, Salesforce Objects, Enterprise Application Development
    Shiv Kumar Sharma Apr 3, 2018
    1,985  Views
    Salesforce Lightning Development Tutorial  - Hello World!

    Salesforce Lightning Development Tutorial - Hello World!

    Video in Others

    Salesforce Lightning Custom Component Development Tutorial for Beginners - Let us implement our first custom lightning component - Hello World! Video Resource: Lightning Evangelist

    Salesforce Development, Salesforce Tutorial for Beginners, Salesforce Lightning, Salesforce Tutorials, Salesforce Developer Console
    Pooja Dec 9, 2019
    2,508  Views
    Salesforce Editions Explained

    Salesforce Editions Explained

    Video in Salesforce Admin

    In this video, we break down the Salesforce Editions—Essentials, Professional, Enterprise, and Unlimited—to help you understand which one is best for your business. Whether you're…

    Elastik Sep 5, 2025
    58  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.