There must have been times when creating a map from a SOQL is required. I am showing 2 ways of doing the same. Map from List ( obtained from SOQL)Map<Id, CustomObj__c> myMap = new Map<Id, CustomObj__c>();for(CustomObj__c objCS : [Select Id Name,Status__c From CustomObj__c ]){myMap.put(objCS.Id, objCS); …
Category: Salesforce
Salesforce Related
Permanent link to this article: https://salesforcebuddy.com/2019/01/salesforce-collections-map-from-soql/
Jan 22
Salesforce Collections – Maps
Maps are pretty useful and can make your code more readable and efficient. In particular, maps can be instantiated in a number of ways. Here is the standard way of instantiating a map: Map<Id, Account> accountsById = new Map<Id, Account>(); However, if you happen to have a list of sObjects you can just pass that …
Permanent link to this article: https://salesforcebuddy.com/2019/01/salesforce-collections-maps/
Dec 22
Custom Settings
Custom Settings: – Custom Setting in Salesforce is similar to Custom Objects that can be used to persist some sort of data. Most important thing about Custom Setting is, it does not uses our salesforce data storage and resides in the application cache. When using Custom Settings there is no Need of SOQL to retrieve the data. Custom …
Permanent link to this article: https://salesforcebuddy.com/2018/12/custom-settings/