The Actual Hours on the Project get updated whenever the user tracks time to a Project. The Actual Hours field also gets updated when the user edits any time details for the Project.
We have a trigger that updates the Actual Hours field,
Here is a description of the logic that the trigger uses:
- When time is tracked or added to a project, the hours worked on the time detail are updated to the Actual Hours on the project
- e.g:
- Project Greenhouse has 20 Actual Hours already logged,
- A user creates a new time entry with 5 hours for the same Project,
- The Trigger adds 5 hours to the Actual 20 hours,
- Now the final Actual Hours on the project Greenhouse is 25 hours (20 hours + 5 hours from Time entry=25 hours)
Updating the Actual Hours:
- If the user updates the time record (TT Details) manually, the Trigger will add/subtract the hours from the Actual hours on the Project object,
- e.g:
- Project Greenhouse has 25 Actual Hours already logged.
- When a user edits the time details by modifying the hours from 5 hours to 4 hours. The trigger will modify the actual hours on the project.
- Now the actual hours on the Project will be 24 hours,
- The new value of the Actual Hours is 25-5+4=24
Note: The Actual Hours field can be on any object and the trigger works the same. We chose the Project object as a sample in this article.