function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mateo AlcauterMateo Alcauter 

field cannot be grouped in a query call

How can i get the users photo in this SOQL query

List<AggregateResult> badges= [SELECT Recipient.Name rec, count(id) cnt, Recipient.FullPhotoUrl From WorkBadge GROUP BY Recipient.Name, Recipient.FullPhotoUrl HAVING count(id) > 0 ORDER BY count(id) DESC];          

I'm getting the error message:  field 'FullPhotoUrl' can not be grouped in a query call     
Best Answer chosen by Mateo Alcauter
Raj VakatiRaj Vakati
What you have to do it is, you need to query it as a normal query and perform the aggregating though code 

All Answers

Raj VakatiRaj Vakati
Hi Mateo. 
Looks like FullPhotoURL is not groupable as per the document. Please refer this link 
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_user.htm?search_text=Group
 
Raj VakatiRaj Vakati
What you have to do it is, you need to query it as a normal query and perform the aggregating though code 
This was selected as the best answer