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 › 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, 2 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]);

    • 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

    application solution

    Popular Salesforce Blogs

    Salesforce vs Hubspot: Which CRM is the Best Fit for Your Business Needs?

    Blog in Salesforce

    As companies grow and expand, managing customer relationships becomes a complex and challenging task. This is where customer relationship management (CRM) software comes into play.…

    Attract, Benefits, Best Suited, budget, Business
    Kizzy Consulting Jul 3, 2023
    1,505  Views

    Trailhead: Your Best Ally to Learn Salesforce

    Blog in Salesforce Trailhead

    Salesforce is one of the most used platforms in the business ecosystem. That is why the skills required for its successful operation are growing rapidly.…

    Apple, Badges, Badges on Trailhead, Best Practices, Business
    SkyPlanner Oct 4, 2021
    2,517  Views

    End-to-End Salesforce Services in the USA: Transforming Business with DigiIQ

    Blog in Salesforce Cloud Platform

    In the rapidly evolving digital economy of the United States, businesses are under constant pressure to innovate, scale efficiently, and deliver seamless customer experiences. Organizations…

    Digiiq Feb 27, 2026
    242  Views

    Popular Salesforce Videos

    Salesforce Business Analyst Training

    Salesforce Business Analyst Training

    Video in Salesforce Training

    In the 35th Episode of the #AskTheHulk series, Savitha Asked about how to switch to IT from Non-IT background. To this question, Shrey suggested that…

    Salesforce Training, Salesforce Consulting Partner, salesforce, Salesforce Hulk, Salesforce Ecosystem
    S2 Dec 22, 2022
    1,387  Views
    Selling the Idea of Salesforce to Your Company - Make Your Own Experience

    Selling the Idea of Salesforce to Your Company - Make Your Own Experience

    Video in Sales

    Salesforce can be a great asset for companies, but sometimes it can be tough to sell the idea of implementing it to decision-makers. In this…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Learning, Implementing Salesforce
    Rahul kapoor Sep 2, 2022
    2,151  Views
    Manual & Apex Managed Sharing in Salesforce

    Manual & Apex Managed Sharing in Salesforce

    Video in Salesforce Apps

    In this video, we will talk about Manual Sharing and Apex Managed Sharing. Manual Sharing Manual Sharing is used to share the record Manually. For…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, sharing rules
    Jogender Dec 31, 2020
    2,904  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®.

    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.