You need to sign in to do that
Don't have an account?
Ebrahim Abdulsattar
Ranking Trigger
I'm trying to create a trigger to rank sales team members for this week, last week and this month. this is based on events/activities object. I created a new custom object with the following fields:
and what I want to achieve is to run this trigger every hour to gather all the changed status events with in the last hour and calculate few fields from the events and add them to the Score field in my object. Once the score is added, then I'd like to rank the users based on their score.
Thank you!
User Rank Score Date/Time
and what I want to achieve is to run this trigger every hour to gather all the changed status events with in the last hour and calculate few fields from the events and add them to the Score field in my object. Once the score is added, then I'd like to rank the users based on their score.
Thank you!
A trigger can be written only when you have to perform any DML operations. I believe if you wanted to update those custom fields then do SOQL on event/activities and compare old and new values using Maps. After comparison, update these custom fields with either event/activities fields or with some specific values based on your requirement.
Note:
1. A trigger should be on that object which is the triggering point
2. If you are comparing values use Trigger.newMap and trigger.oldMap.
3. Event type should be -After insert, after update
Hope this helps.
Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra