NetSuite offers great value by allowing your 1099 contractors to submit timesheets which can serve your professional services business. The one challenge though is the Detailed Timesheet Form automatically marks the Supervisor Approval Flag as true. This can cause a processing challenge when you want to approve time using the approval feature as expected. NetSuite has known about this for sometime now so we decided to take matters into our hands.
Here is a script to solve it. Create a User Event Script with the script content below. Assign it to the NetSuite Time object. Set the After Submit event to “ID004_Uncheck_Supervisor_Approval_Flag”. Then, be sure to assign this script to only execute with roles that are used by your 1099 vendors. This step is important because you don’t want it to run for regular employees.
Let me know if you need help installing it.
function ID004_Uncheck_Supervisor_Approval_Flag(type) { nlapiLogExecution('DEBUG','type is ' + type); var recordID = nlapiGetRecordId(); nlapiLogExecution('DEBUG','recordID is ' + recordID); if (recordID){ if (type == 'create') { var rec = nlapiLoadRecord('timebill', recordID); var vendorid = rec.getFieldValue('employee'); nlapiLogExecution('DEBUG','Create Supervisorflag start is ' + rec.getFieldValue('supervisorapproval')); nlapiLogExecution('DEBUG','Looking Up Employee/Vendor ID: ' + vendorid); try { vendorid = nlapiLoadRecord('vendor', vendorid); if (vendorid) { nlapiLogExecution('DEBUG','Vendor ' + vendorid + " found."); //if vendor ID is found, then go ahead with time record modification rec.setFieldValue('supervisorapproval','F'); var id = nlapiSubmitRecord(rec, true); } else { nlapiLogExecution('DEBUG','Employee ' + vendorid + " found. Nothing to do."); } } catch ( e ) { //do nothing. This is not a vendor. nlapiLogExecution('DEBUG','Vendor not found. This is an employee. Nothing to do.'); } nlapiLogExecution('DEBUG','Create Supervisorflag End is ' + rec.getFieldValue('supervisorapproval')); } if (type == 'edit') { var rec = nlapiLoadRecord('timebill', recordID); var vendorid = rec.getFieldValue('employee'); var status = rec.getFieldValue('status') nlapiLogExecution('DEBUG','Edit Status is ' + status); nlapiLogExecution('DEBUG','Edit Supervisorflag start is ' + rec.getFieldValue('supervisorapproval')); nlapiLogExecution('DEBUG','Looking Up Employee/Vendor ID: ' + vendorid); try { vendorid = nlapiLoadRecord('vendor', vendorid); if (vendorid) { nlapiLogExecution('DEBUG','Vendor ' + vendorid + " found."); //if vendor ID is found, then go ahead with time record modification rec.setFieldValue('supervisorapproval','F'); var id = nlapiSubmitRecord(rec, true); } else { nlapiLogExecution('DEBUG','Employee ' + vendorid + " found. Nothing to do."); } } catch ( e ) { //do nothing. This is not a vendor. nlapiLogExecution('DEBUG','Vendor not found. This is an employee. Nothing to do.'); } nlapiLogExecution('DEBUG','Edit Supervisorflag End is ' + rec.getFieldValue('supervisorapproval')); } } }