You need to sign in to do that
Don't have an account?
DJP
Calculate hours of the current week
Hello
I have requirement to calculate today hours for the current week.
We have custom object Tracker__C and field Hours__C. Hours__C is user entered field. Next to the user entered field we wanted to show the users total hours he has entered thus far this week.
For example (Day of the week - Hours entered - Total hours this week)
Monday - 4 - 4
Tuesday - 6 - 10
Wednesday - 2 - 12
Thursday - 8 - 20
Friday - 8 - 28
All help appreciated
Thanks
Dinesh
I have requirement to calculate today hours for the current week.
We have custom object Tracker__C and field Hours__C. Hours__C is user entered field. Next to the user entered field we wanted to show the users total hours he has entered thus far this week.
For example (Day of the week - Hours entered - Total hours this week)
Monday - 4 - 4
Tuesday - 6 - 10
Wednesday - 2 - 12
Thursday - 8 - 20
Friday - 8 - 28
All help appreciated
Thanks
Dinesh
All Answers
If you create a formula field that will appear only after saving the data ..
How formula field will work in this case? Can you give some perspective?
Other fields other than system fields on the custom object Tracker__C are, Account__C (has lookup relationship with Account), Date_Visited__c, Comments__c and the one I mentioned in the original question Hours__C. We have a request to add two more fields 1 is the OpportunityID__C which will have look up with Opportunity object and other is the totalhoursweek__C which is the one I have challenge with.
For Monday it will always show the hours entered for Monday, For tuesday it will show hours entered on Monday + Hours entered on Tuesday so on and so forth.
Thanks
Dinesh
The trigger works to the most part however one issue is it adds all hours for this object on total hours field.
It should only total the hours for current week.
If I have hours for two weeks and it calculates total hours for both weeks.
Thanks for your response
Dinesh
If I misunderstood, sorry for that and if you explain with example what is doing that would help.
The work week is from Monday to Friday. User will enter hours at the end of the day. So on Monday totalhoursweek__c will show the hours he entered since its the first day of the week. On tuesday the field totalhoursweek__c will show hours entered on Monday + Hours entered on Tuesday. On Wednesday totalhoursweek__c field will show hours entered on Monday + Tuesday + Wednesday so on and so forth. This will repeat for each week. From next Monday the value is reset and starts all over again for new entries. The table below might help.
Thanks Again
Salesforce consider Sunday the first day of the week, but if there is no entry on that Day, the code must work as per expectation.
Let me know if that work