@cloudcoder Get Chatter Top Posters


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public List<Recommendation> getRecipeEightTopPosters()
  2. {
  3. List<AggregateResult> results = [
  4. SELECT ParentId pid, Parent.Name pname, COUNT(id) fcount
  5. FROM UserFeed
  6. WHERE Type='UserStatus'
  7. AND CreatedDate = THIS_WEEK
  8. GROUP BY Parent.Name, ParentId
  9. ORDER BY Count(id) DESC LIMIT 10];
  10.  
  11. List<Recommendation> top = new List<Recommendation>();
  12. Recommendation r = null;
  13.  
  14. for (AggregateResult ar : results)
  15. {
  16. r = new Recommendation();
  17. r.count = ar.get('fcount') + '';
  18. r.name = ar.get('pname')+'';
  19. r.entityid = ar.get('pid')+'';
  20. top.add(r);
  21. }
  22. return top;
  23. }
  24.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.