Create Time Sheet in NetSuite

let timesheetRecord = record.create({ type: record.Type.TIME_BILL, isDynamic: true }); 
timesheetRecord.setValue({ fieldId: 'employee', value: empId }); 
imesheetRecord.setValue({ fieldId: 'trandate', value: formatteddatetime }); 
timesheetRecord.setValue({ fieldId: 'customer', value: taskDetails.companyName }); 
timesheetRecord.setValue({ fieldId: 'casetaskevent', value: taskDetails.internalId });
 let timeHours = hours / 60; 
timesheetRecord.setValue({ fieldId: 'hours', value: timeHours }); 
timesheetRecord.setValue({ fieldId: 'isbillable', value: false }); 
timesheetRecord.setValue({ fieldId: 'approvalstatus', value: 3 }); 
timesheetRecord.setValue({ fieldId: 'custcol_jj_time_sheet_id', value: doc.id }); 
timesheetRecord.setValue({ fieldId: 'custcol_jj_location_time_sheet', value: taskDetails.location }); 
let timesheetId = timesheetRecord.save({ enableSourcing: true, ignoreMandatoryFields: true });

Leave a comment

Your email address will not be published. Required fields are marked *