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

Hey Everyone... Can you give me a hand figuring this out?

Hello Everyone,

I'm hoping someone out there can help me figure this out.  It would be awesome.  We have added Service Timecard Custom Object Records to our system to track billable hours on Jobs and for customers.  The are linked to a few different parent items (including Accounts, Cases, Projects).  When I pull up a case per say it shows me the Service Timecard section as a section below the main information, and all of the timecards associated with that case.

Ok here is what I'm looking to do.  I would like to have a Formula field add up all of the hours worked contained within the Service Timecards associated with that Record. 

IE if there is a case with 2 service timecards.  One for 1 hour and one for 2 hours, on the case record I could have a field show us Total Time Worked : 3 Hours.

If anyone can show me how to do this I would owe you a huge favor.

Thanks so much.

Dan Levine

Currently the only way of doing this is with a custom sControl.  The problem is that a formula field can only reference fields on it's own object.  It can't access children objects to it.  This is suppose to be an improvement included in the Winter '07 Release that will allow some calculations with values from children objects but I can't say for sure.

How hard would it be to make a custom S-Control?  I'm not sure about S-Controls, but I will start looking into them.
Im assuming you've sorted this out given the time from last post, but is there ay reason you couldnt just run a report to add up time spent on a job? 

If the time card is a custom object, then you could do a report that summarised by project and totalled the time on job.  Then place a custom link onto parent object page to run the report - one click to see what projects have been done with a given account, and how much time spent on them.
Hell's KitchenHell's Kitchen
There is an app on the Appexchange that has an S-Control similar to what you need. It was created by Salesforce, so it is free, and I believe that you would be allowed to take the code in the S-Control, tweak it for your organization and theoretically be good to go.

On the Appexchange, find the application called "Volunteer Management."  Open the Test Drive and look at the "Volunteer Events" tab. The fields named "# of Volunteers" and "Total Hours Volunteered" are calculated from the related records below, "Volunteer Participants." The fields are updated only when a user clicks the button entitled, "Calculate Totals."

To see the code, click "Setup" at the top of the Test Drive window. Then in the left side bar, click "Customize" and then "S-Controls."  The S-Control you want (the code that is executed when the button is clicked) is entitled "Volunteer Management - Calculate Totals."  Click the title to see the code and/or copy the text if you wish.

If you know Javascript, I believe that you should be able to tweak the fields in the code so that the script totals fields you need on related records. Otherwise, someone with basic Javascript knowledge and basic understanding of Salesforce & the API should be able to make the code customization for you.

Good luck!

If anyone can program this the way we need it to work I can pay them $200 or perhaps cost on any plasma/lcd screen they would like?