[SalesForce] Trigger on Opportunity to update User object

Trigger on Opportunity to update User object

I need to make a trigger on the opportunity object that Adds +1 to a custom filed on the user object every time an opportunity that the user owns has the "Date qualified" field changed from null to having a date.

What I am trying to do is get a count on the user object of how many opps are qualified MTD. Then I can run a report that will show how many reps that have zero opps along with the reps that have opps.

I tired making a workflow but the field update can't cross to the user object. And I am not sure were to start on this code. Any help would be great.

Best Answer

I would do this with a matrix report

  • Rows: Opportunity Owner
  • Columns: Date qualified (grouped by month)
  • Cell: Record count
  • Report filter: Date_qualified__c not equal null and date_qualified in Current Calendar year

If you store the count on User, you have to clear it out every month in order to get MTD

Related Topic