I am trying to run a scheduled script that mass updates past item fulfillments. We have a custom column for projects (custcol_col_project), and we need the main line project to populate that column for each line item.
Right now, the script is Completing, and all the logging is done, including getting the project ID. However, when I look at the item fulfillments, nothing has changed.
function updateJob_LineItem() { var records = nlapiSearchRecord('transaction', 607, null, null); //this is the internalID for the search to find related item fulfillments for ( var i = 0; records != null && i < records.length; i++ ) { try { var record = nlapiLoadRecord( records[i].getRecordType(), records[i].getId() ); var project = record.getFieldValue('entity'); var tranid = record.getFieldValue('tranid'); nlapiLogExecution('DEBUG', 'Record #' + (i+1) + ' Details', 'TranID = ' + tranid +', Project = ' + project); lines = record.getLineItemCount('item'); for ( var j = 1 ; j<= lines ; j++ ) { record.setLineItemValue('item', 'custcol_col_project', j, project); nlapiLogExecution('DEBUG', 'line updated'); } nlapiSubmitRecord(record, false, true); nlapiLogExecution('DEBUG', 'tran saved'); } catch(err){ errorDetailMsg = "Error updating Internal ID "+ tranid +". "; continue; } } }