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

Calculate total hours from all child records

Hi all,

We have an object called Project and a child object called assignment which both share a common field called hours.  
A user enters an assignment and enters hours.  The project page has a field which calculates the total hours from all the individual assignments

There is a hierachy structure of master project and sub projects and what I am trying to achieve is have a field on the master project calculate all the total hours from all the sub projects.
I am guessing this is a trigger, of which I have acompletely run out of capabilities and need help.

The current calculation to show the total hours on the project page was done using the salesforce rollup summaries app and I think I need a trigger of some sort using a statement to match the project id's?


What is a relationship between master project and subproject , I believe it should be master-detail and you can use rollup summary in that case to caluclaute the value.

Its a parent child relationship on the project object.

we have a calculation on the project object which totals all the hours on each assignment, but we want to be able to calculate all these totals of each sub project to roll up to a total on the master project.