Salesforce Apex: Namespace and Field Name in AggregateResult

In Salesforce SOQL, we can use the aggregate function to summarize data in query. When an aggregate function is used, Salesforce will return the result as AggregateResult object and we can retrieve the value by calling AggregateResult.get(‘field name’). For example:   for(AggregateResult ar : [select count(Id), Business_Type__c from Account group by Business_Type__c]){ system.debug(ar.get(‘expr0’)); //get the…

Read More