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, 9 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

    Salesforce Sandbox

    Salesforce Sandbox Types and When To Use

    Blog in Salesforce

    Customer experience has become a preferred priority for 88% of companies nowadays because customers choose customization and upgradation over generalist solutions. And, to adapt to…

    Apps, Business, Code and Configuration, Codes, Configurations
    Bolt Dec 15, 2021
    4,765  Views
    Salesforce Coding Utility Chrome Extension

    Salesforce Coding Utility Chrome Extension

    Blog in Coding and Scripting, Salesforce integration

    This is Salesforce coding utility Chrome extension. This is a very cool extension. I have made this for me and my friends. But after some…

    Chrome Extensions, Customized Salesforce App, Salesforce Code, Salesforce Implementation, Salesforce Utility
    0to1Code.Com Jun 23, 2017
    4,893  Views

    How Much Does Salesforce Pardot Implementation Cost? Let’s Find Out!

    Blog in Salesforce Products

    Are you planning to invest in Pardot? Great choice. It is the most comprehensive B2B marketing automation tool out there. But every major decision smuggles…

    B2B Marketing Automation Tool, Business, Business Needs, Business Objectives, Business Processes
    LevelShift (formerly DemandBlue) Aug 16, 2021
    3,368  Views

    Popular Salesforce Videos

    Salesforce Spring 22 Treasure Hunt for Flow | Migrate your Workflow Rules to Flows

    Salesforce Spring 22 Treasure Hunt for Flow | Migrate your Workflow Rules to Flows

    Video in Salesforce Stories

    Salesforce Spring 22 Treasure Hunt for Flow 0:00 Register for pre-release org 0:27 Flow Trigger Explorer 2:07 Auto-Layout and Freeform option as Picklist 3:00 Set…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    Jogender Dec 30, 2021
    2,107  Views
    Salesforce enthusiasts welcomes you to the Trailhead! Skill up for the future.

    Salesforce enthusiasts welcomes you to the Trailhead! Skill up for the future.

    Video in Others

    A trailhead is defined as an outdoor space that is designated by an entity responsible for administering or maintaining a trail to serve as an…

    Salesforce Trailhead, Salesforce Events, Dreamforce 2019, DF 19, Dreamforce 19
    Algoworks Nov 29, 2019
    1,805  Views
    How Cyntexa Helped Diet Meal And Food Ordering Service Providers Offer Their Users The Ability To Order Online | Salesforce Commerce Cloud

    How Cyntexa Helped Diet Meal And Food Ordering Service Providers Offer Their Users The Ability To Order Online | Salesforce Commerce Cloud

    Video in Salesforce Stories

    It is important to keep your business at the top with the latest technical advancements. Presenting you a case study showcasing how Cyntexa Helped Diet…

    Salesforce Training, salesforce, salesforce services, Salesforce Tutorials, Salesforce Video
    Cyntexa Jan 16, 2023
    1,245  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.