/* Customer: 33 Location: 02: Boston Item: ACC00003 Write a script to automatically bill sales orders as soon as the orders are approved. */ function afterSubmit (type){ try{ nlapiLogExecution('Audit', 'After Submit Function', 'Begin'); var recordId = nlapiGetRecordId(); var recordType = nlapiGetRecordType(); var recordObj = nlapiLoadRecord(recordType, recordId); nlapiLogExecution('Debug', 'Record Object', 'Record Object: ' + recordObj); var status = recordObj.getFieldText("orderstatus"); nlapiLogExecution('Debug', 'Status', 'The status for the record is ' + status); if (status == "Pending Approval" || status == "Pending Fulfillment"){ recordObj.setFieldText('orderstatus', 'Pending Fulfillment'); var pendingFullfillment = recordObj.getFieldText('orderstatus'); nlapiLogExecution('Debug', 'Set Field Text: Pending Fullfillment', 'Switch: ' + pendingFullfillment); var transformType = "Invoice"; //Issues Arrises Here nlapiTransformRecord(recordType, recordId, transformType); nlapiLogExecution('Debug', 'Transform Type', recordType); nlapiSubmitRecord(recordObj, true, true); }; nlapiLogExecution('Audit', 'After Submit Function', 'End'); } catch(ex){ nlapiLogExecution("Emergency", "Exception", "Exeception: " + ex); } }