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

    Dreamforce 2022 - An Overview of the Salesforce Largest Software Conference

    Blog in Salesforce

    Hello Trailblazers, are you ready to attend the most impactful Dreamforce event ever? This year will be an extra special and epic Salesforce family reunion…

    Business Opportunities, Business Verticals, DF22, Dreamfest, Dreamforce
    LevelShift (formerly DemandBlue) Aug 31, 2022
    2,983  Views

    Salesforce and NLP: A Powerful Combination for Business growth

    Blog in Salesforce

    Salesforce, a leading CRM platform, has been at the forefront of technological advancements. One such significant advancement is the integration of Natural Language Processing (NLP).…

    Benefits of Salesforce, Business Process, NLP, salesforcedeveloper
    Cloudy Aug 1, 2025
    353  Views

    Tips to Prepare Your Salesforce Data for a Perfect AI Integration

    Blog in Salesforce integration

    Salesforce is the finest Customer Relationship Management (CRM) software available today. It lets you keep a proper track of customer interactions and sales data. However, leveraging this…

    Artificial Intelligence, Business Efficiency, CRM Software, Customer Relationship, Data Analysis
    Ato Apr 5, 2024
    842  Views

    Popular Salesforce Videos

    What is Salesforce Apex Trigger | When to use Salesforce Apex Trigger | Type of Salesforce Apex Trigger

    What is Salesforce Apex Trigger | When to use Salesforce Apex Trigger | Type of Salesforce Apex Trigger

    Video in Others

    In this video, we are going to learn some basic concepts of Apex trigger. Below is the Agenda. Video Resource: SFDC Panther

    Salesforce Apex, Apex, Salesforce Apex Trigger, SFDC, Salesforce Basics
    Pooja Nov 1, 2019
    1,951  Views
    Building Slack Apps with Apex on Salesforce

    Building Slack Apps with Apex on Salesforce

    Video in Salesforce Training, Salesforce Apps

    Slack has traditionally been associated more with non-Salesforce backends such as AWS. Now that Slack is a Salesforce product, Salesforce developers are probably curious about…

    Salesforce Training, Salesforce Tutorial, Salesforce Developers, Salesforce Video, salesforce product
    Prafull Apr 26, 2022
    2,244  Views
    Salesforce Einstein – CRM Stepping Into The World Of AI

    Salesforce Einstein – CRM Stepping Into The World Of AI

    Video in AI and ML

    We belong to a hyper-connected world these days where each and every step we take is an onslaught of data. So for this world what…

    Salesforce Chatter, Artificial Intelligence, Cloud Computing, Sales Cloud Einstein, Salesforce Cloud
    Algoworks Jan 11, 2018
    2,091  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.