MoCheeks
07/17/2020, 5:45 PMfunction pageInit(context) {
try {
var currAWP = context.currentRecord;
hideAmountSublist(context);
currAWP.setValue({
fieldId: 'custbody_avail_labor',
value: getAvailableLabor(currAWP)
});
currAWP.getField({fieldId: 'custbody_avail_labor'}).isDisabled = true;
} catch (e) {
log.error(e.message);
}
}
function getAvailableLabor (currAWP) {
try{
var clockInTime = (currAWP.getValue({
fieldId: 'custbody_clock_in_time'
}));
var clockOutTime = (currAWP.getValue({
fieldId: 'custbody_clock_out_time'
}));
var serviceChannelOnsite = (currAWP.getValue({
fieldId: 'custbody_sc_time_onsite'
}));
var availLabor = (((clockOutTime - clockInTime)/3600000)*60);
if(serviceChannelOnsite){
availLabor = (serviceChannelOnsite*60);
}
return availLabor.toFixed(2);
}catch (e){
log.error (e.message);
}
}
Lincecum
07/17/2020, 6:10 PMLincecum
07/17/2020, 6:10 PMdebugger
within your getAvailableLabor
and open chrome dev tool via f12
MoCheeks
07/17/2020, 10:28 PMMoCheeks
07/17/2020, 10:29 PMLincecum
07/20/2020, 1:29 AM