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
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:
Test Class:
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?