Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

How can I do it if I want to run a SOQL Query and get a Map returned?

Asked by Ashish Sinha Sep 11, 2023 1.2K views 1 answer
Share

About this question

 It is possible to run a query, and the results are inserted into an Apex list:

List opportunities = [SELECT Opportunity.OwnerId,
                                          Opportunity.Probability,  
                                          Owner. Name FROM Opportunity 
                                    WHERE Opportunity.LastModifiedDate = LAST_N_DAYS:7];

Is it possible to get Soql to map where OpportunityID would be the key and the value of the Opportunity? If there is none, please tell me the quickest way to convert to a map. 

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.