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
OcoBriOcoBri 

How to sum "billable hours" from Events on a custom object?

I have a custom object with activities (events or tasks; they confuse me) to record hours worked (start datetime and end datetime). How can I sum the hours worked both on the activity, and on the custom object for all activities?
I could also use another custom object instead of Activities.
Thank you.
bob_buzzardbob_buzzard
You'd need to write an apex trigger to use activities in this way.  Using a custom object to capture start/end date time would be more straightforward, as you could then create a formula field to figure out the difference between the two datetimes (example at : http://stackoverflow.com/questions/11126378/salesforce-formula-calculate-business-hours-between-two-dates), and create a roll up summary that totals all of the child record formula fields.
AshwaniAshwani
Event object has StartDate and EndDate field. These fields can be utilized to calculate hours. Use of cutom object may not be useful as Event object is built for these type of requirement. Custom object will require lot of thinking and development effort and still require a triiger to acheive results.
bob_buzzardbob_buzzard
@Avillon : A custom object won't require a trigger - this is a classic use case for a rollup summary.