Unable to achieve multiple timecard in a single timesheet - minimum 8 hours per day 40 hrs per week
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2025 10:37 PM
Hi All,
We are exploring to achieve a requirement wherein we need to 8 hours minimum per day and 40 hours per week. Also, there would be multiple timecards in a single timesheet.
We were able to customize to achieve 40 hours per week however when we are trying to do it for 8 hours per day minimum while having multiple timecards in a single timesheet, it is not letting us do.
Looking forward for your support and guidance to achieve this.
Regards,
Ashish Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2025 02:06 AM
Hi,
A script like this should do it:
var gr = new GlideRecord("time_card");
gr.addEncodedQuery("time_sheet="+current.time_sheet.sys_id);
gr.query();
var timeSheetTotals = {
"monday":0,
"tuesday":0,
"wed",0,
"thurs",0,
"fri",0
}
while(gr.next()){
timeSheetTotals.monday += gr.monday;
timeSheetTotals.tuesday+= gr.tuesday;
// do the rest of the days
}
//check each day is over 8 hours
if(timeSheetTotals > 8){
//over 8 hours, do something here
}