Unable to achieve multiple timecard in a single timesheet - minimum 8 hours per day 40 hrs per week

Ashish9991
Tera Contributor

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

1 REPLY 1

Jake Sadler
Kilo Sage

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

 

}