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 › Is it possible to run a SOQL Query and get a MAP returned?

    Tagged: Account, Apex Map, Salesforce Apex, Salesforce Query, SOQL

    • Salesforce® Discussions

      Is it possible to run a SOQL Query and get a MAP returned?

      Posted by Tanu on August 5, 2016 at 1:16 PM

      Is it possible to run a SOQL Query and get a MAP returned?

      Ajay Prakash replied 8 years, 9 months ago 3 Members · 2 Replies
      • Account
      • Apex Map
      • Salesforce Apex
      • Salesforce Query
      • SOQL
    • 2 Replies
    • Himanshu

      Member
      August 5, 2016 at 1:32 PM

      Hi Tanu,You can use the below query

      Map m = new Map([SELECT Id, Name FROM Account]);

    • [adinserter block='9']
    • Ajay Prakash

      Member
      January 13, 2018 at 3:16 PM

      Hi Tanu,

      Yes, You can run SOQL query and return into a map. You can refer below code it will return a map of Account id vs Account map-

      Map<id,Account> mapOfAccountIdVsAccount = new Map<Id,Account>([SELECT Id, Name FROM Account]);
      system.debug('mapOfAccountIdVsAccount::'+mapOfAccountIdVsAccount);

      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

    Top Salesforce Features for Developers to Try Out in 2022

    Blog in Salesforce Releases

    With Spring ‘22 release, there’s a lot that’s new for Salesforce developers that they can look forward to. The release has come up with some…

    AppExchange Packages, Before-save Flows, Build Solutions, Components, Developers
    360 Degree Mar 8, 2022
    2,996  Views

    Guide for Small Business: Unlocking Growth with Salesforce Pro Suite

    Blog in Salesforce Products

    In the evolving digital landscape, Salesforce for small businesses is not just a CRM platform; it's a growth accelerator, reshaping how SMEs connect with customers…

    AppExchange Integration, Business Insights, Cloud Based CRM, CRM Customization, CRM Flexibility
    Routine Automation Jun 4, 2024
    798  Views
    What is Enhanced Domain Deployment?

    What is Enhanced Domain Deployment in Salesforce in 2023?

    Blog in Others

    The next edition of My Domain is enhanced domains. With enhanced domains, all URLs in your organization, including those for your Experience Cloud sites, Salesforce…

    Enhanced Domain, Enhanced Domain URL, Enhanced Domain URLs, Enhanced domains, Experience Builder
    saurabh Mar 31, 2023
    1,880  Views

    Popular Salesforce Videos

    How to Deliver Great Customer Service With a Small Team [Salesforce Webinar]

    How to Deliver Great Customer Service With a Small Team [Salesforce Webinar]

    Video in Salesforce Training

    Overwhelmed by a backlog of customer service requests? And worried your team is too small to handle all the requests? Then, this video is for…

    Salesforce Online Training, Customer Success, Best Salesforce Tutorials, Automate Business Processes, Sales Productivity
    Jogender Mar 27, 2018
    2,164  Views
    Provide Stellar CX With Grazitti | Be Salesforce Ready

    Provide Stellar CX With Grazitti | Be Salesforce Ready

    Video in Salesforce Products

    Brands, nowadays, need to build powerful customer relationships and provide experiences that meet and exceed expectations. With evolving technologies, customers hate to stay in queues…

    salesforce, salesforce services, Salesforce Tutorials, Salesforce Video, Salesforce Learning
    Shubham Jan 18, 2023
    1,545  Views
    Demo - Increase Your Sales Effectiveness With Sales Enablement and eSigning Inside Salesforce

    Demo - Increase Your Sales Effectiveness With Sales Enablement and eSigning Inside Salesforce

    Video in Salesforce Integration, Salesforce Training

    In this video you will learn how to increase your sales effectiveness by creating, sending, tracking and engaging your potential customer, right inside Salesforce, through…

    Salesforce Training, Salesforce Integration, Salesforce Video, sales, Salsforce
    Abhai Deep May 4, 2020
    1,551  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.