+ Start a Discussion
Coral RacingCoral Racing 

Trigger Help to Count Number of Cases created for each User


I am needing the help of salesforce developer community to help me with a trigger to count the number of tickets or cases each user or Client has raised/created ( all time), so that this can be added to a hidden custom field so I can report on the top 10 using the tabular type of report.

can anyone help?  I have no idea where to start?

Many thanks

Surendra nuneSurendra nune
Try using aggregate queries group by user/client and update the field .
Mayank Srivastava (Salesforce fan)Mayank Srivastava (Salesforce fan)
I worked on a similar task a couple of weeks ago. Use this code to design something as per your requirements. 

Main code: https://gist.github.com/miragedeb/87fd6d0262eee960d82c
Test Class: https://gist.github.com/miragedeb/c758bce9f4200519dd33
Coral RacingCoral Racing
Hi Miragedeb

Thanks for this.  I am newbie to Salesforce.  Say I needed to do this on a Custom object called Incident__c, do I just subtitute Cases for Incident?