+ Start a Discussion

trigger or class for the following senario


I have following entries on perio__c sObject.

Id                use__c          aggregated_use__c      year
a2vL.......       0                                                       2013
a2vLi......       2                                                       2013
a2vLu.....       0                                                       2013
a2vLe.....       2                                                       2013
a3vK3.....       1                                                       2014
a3vK4.....       2                                                       2014

I would like to aggregat "use__c" values and update on aggregated_use__c field. So the result would be on perio__c sObject....

Id                use__c          aggregated_use__c      year
a2vL.......       0                           0                          2013
a2vLi......       2                           2                          2013
a2vLu.....       0                           2                          2013
a2vLe.....       2                           4                          2013
a3vK3.....       1                           1                          2014
a3vK4.....       2                           3                          2014         
Can anyone add some intputs with an example?

Many thanks,
Basically we can write the trigger and/or class for this requirement. However, it needs some DML operation to happen on these records to execute a trigger.

- To do this you first need to write a trigger as per your requiement.
- Export the id's of these records using dataloader/workbench
- Do a blank update using dataloader/workbench by mapping only the id field, this will execute the background trigger and/or class and update the fields accordingly.

- You can also rely on workflow rules if the field update requirement is simple.

Hope this helps !!
Thanks for the idea.

Can you explain the points into an example? As i might not understand correctly.