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

    Loan Processing, Qualification, and KYC Automation in Salesforce

    Blog in Salesforce

    Financial institutions always work on improving customer service, so they strive for improvements in work efficiency. The most important feature they need here is process…

    Automated Solutions, Automated Workflow, Customer Behaviour, Customer Details, Customer Service
    360 Degree Sep 30, 2021
    2,509  Views

    How to Become a Successful Salesforce Developer: A Comprehensive Guide

    Blog in Others

    Gaining the necessary abilities can lead to a variety of employment prospects in the rapidly expanding field of Salesforce development, as the demand for Salesforce…

    Become a Salesforce Developer, Salesforce Apex Code, Salesforce Apex Programming, Salesforce Best practices, Salesforce career growth
    AwsQuality Oct 1, 2024
    474  Views
    Enhanced Lookups In Salesforce

    Enhanced Lookups In Salesforce

    Blog in Others

    Records in custom lookup are searchable by Object Name or AutoNumber. What If we want to search the record for any other field value. Just…

    Custom Lookup, Enhanced, Enhanced Lookups, Enhanced Lookups in salesforce, Lookup
    Ajay Prakash Feb 28, 2018
    20,399  Views

    Popular Salesforce Videos

    What Is Salesforce and Why Is It So Good?

    What Is Salesforce and Why Is It So Good?

    Video in Salesforce Stories

    Salesforce is by far the most popular CRM tool for sales, support, and marketing teams worldwide. But what exactly is a CRM and why do…

    Salesforce Development, salesforce, salesforce knowledge, CRM, Salesforce Developers
    Pooja Aug 7, 2020
    1,963  Views
    Getting Started with Salesforce Lightning Process Builder

    Getting Started with Salesforce Lightning Process Builder

    Video in Lightning

    Process Builder is a point and click tool that makes it easy to automate many common Salesforce tasks. Learn how to design and build effective…

    Process Automation, Salesforce Automation, Free Salesforce Tutorials, Salesforce Lightning Process Builder, Process Builder
    Pooja Feb 23, 2018
    1,519  Views
    Unleash Your Salesforce Process Automation With This New Connector For Salesforce Lightning Platform

    Unleash Your Salesforce Process Automation With This New Connector For Salesforce Lightning Platform

    Video in Salesforce Automation

    Unleash your Salesforce process automation with this new Connector for Salesforce Lightning Platform (a set of 130 Activities and 5 wizards that allow you to…

    Salesforce Lightning, Salesforce CRM, Salesforce Lightning Platform, Salesforce Process Automation, New Connector
    Cristian Jul 9, 2020
    2,276  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.