Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fractastical/989763 to your computer and use it in GitHub Desktop.
Save fractastical/989763 to your computer and use it in GitHub Desktop.
@CloudCoder Get Chatter Top Posters
public List<Recommendation> getRecipeEightTopPosters()
{
List<AggregateResult> results = [
SELECT ParentId pid, Parent.Name pname, COUNT(id) fcount
FROM UserFeed
WHERE Type='UserStatus'
AND CreatedDate = THIS_WEEK
GROUP BY Parent.Name, ParentId
ORDER BY Count(id) DESC LIMIT 10];
List<Recommendation> top = new List<Recommendation>();
Recommendation r = null;
for (AggregateResult ar : results)
{
r = new Recommendation();
r.count = ar.get('fcount') + '';
r.name = ar.get('pname')+'';
r.entityid = ar.get('pid')+'';
top.add(r);
}
return top;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment