Toggle Side Panel

  • Blogs
  • 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
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • 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
    • 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, 8 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

    Popular Salesforce Blogs

    [ Part - 3 ] Pushing Google Sheet data into the Salesforce database through G-Connector

    Pushing Google Sheet data into the Salesforce database through G-Connector - Part 3

    Blog in Salesforce integration

    Hi All, Welcome Back to an another blog related to the G-Connector for Salesforce. In my first blog "G-Connector for Salesforce", I shared with you all…

    Enabler4Sheets, G-Connector, G-Connector for Salesforce, Google G-Connector, Google Sheet
    PRANAV May 29, 2018
    9,407  Views
    Apex Integration

    Apex Integration in Salesforce - The Developer Guide

    Blog in Others

    This article closes the arrangement, Learning Salesforce Integration, which subtleties different joining choices with Salesforce. It covers utilizing Apex for building incorporations, which turns into…

    Apex Trigger, Apex Web Administrations, ApexClass, Approval Code, Authentication Call
    Aditya Oct 16, 2020
    7,086  Views
    Salesforce LIGHTNING WEB COMPONENT

    An Introduction to Salesforce Lightning Web Component

    Blog in Lightning

    1) INTRODUCTION TO LIGHTNING WEB COMPONENT: Using HTML and modern JavaScript we can build Lightning web components that are basically custom HTML elements.  Aura components…

    Aura Framework, CRM, Dynamic Rows, JavaScript, javascript developers
    Pooja Mar 24, 2020
    5,239  Views

    Popular Salesforce Videos

    Salesforce Developer to Architect

    Salesforce Developer to Architect

    Video in Salesforce Stories

    In this video, we will look at the top considerations that are crucial to being a successful architect on the Salesforce platform. Even more, We…

    Salesforce Developer, salesforce platform, Salesforce Video, Learning, Salesforce Learning
    Jogender Apr 30, 2021
    2,035  Views
    Process Builder or Apex Triggers - Choosing Between Salesforce Automation Tools

    Process Builder or Apex Triggers - Choosing Between Salesforce Automation Tools

    Video in Salesforce Automation

    The Salesforce Platform offers several means to operate in the background: Process Builder, Triggers, Flow, Workflows, and more. With so many robust options, it can…

    Salesforce Administrator Training, Salesforce Developer, Salesforce Process Builder, Salesforce Triggers, Process Automation
    Abhay Feb 6, 2018
    2,417  Views
    Salesforce Lightning Events Tutorial I Building Component Events (Single Component)

    Salesforce Lightning Events Tutorial I Building Component Events (Single Component)

    Video in Lightning

    This Salesforce Lightning Events Tutorial will make you learn how to register an event in Salesforce Lightning and handle that event in the source component…

    Salesforce Lightning Components, Easy Way To Learn Salesforce, How To Learn Salesforce Lightning, Best Salesforce Tutorials, Free Salesforce Tutorials
    Nauman Jan 7, 2019
    2,456  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.