Chasing down a bug and finally had to resort to logging values to find the problem.
Here is some code first, then I will explain the problem.
// Here are some snippets of the values used below var TRANS_STATUS_LIST = { PEND_APPROVAL : 'A', PEND_FULFILL : 'B', PEND_BILLING : 'F' }; // BTW, transaction status field is 'orderstatus' but the searchfield for status is 'status' - this is the kind of junk that makes people go crazy! var currentSalesOrderStatus = nlapiLookupField(REC_IDS.SO, salesOrderId, TRAN_SRCH_FLD.STATUS); this.AddTraceF('Current SO status: {0}', currentSalesOrderStatus); if( currentSalesOrderStatus != TRANS_STATUS_LIST.PEND_APPROVAL ) { this.AddTrace('SO doesn't need processing, aborting operation'); return; } So the above was always evaluating to true and aborting execution. I finally figured out that the value returned from nlapiLookupField is: 'pendingApproval'What? Why? Where did that come from?If I change the nlapiLookupField call to return text I get "Pending Approval" so WTF is this 'pendingApproval' value that I'm getting back?From the source code of a Sales Order record:var dd = win.makeDropdown('orderstatus', 184, ['Pending Approval', 'A', 'Pending Fulfillment', 'B'], 0, 'A', 'Pending Approval', "this.isvalid=(nlapiValidateField(null,this));if (!this.isvalid) return false;setWindowChanged(window, true);if(!handleOnHoldWhenStatusChanges()) return false;;nlapiFieldChanged(null,this);", null, 200,document,-2147483520); I don't see 'pendingApproval' in there anywhere!!!!!!!!!Someone please, Yang, Evan, Malin, ZACH NELSON... someone please explain why you would ever return different IDs for the same value!!