I am trying to get an afterSubmit to run on orders placed for a specific customer from our web store. The script works great on any sales order taken by phone and entered by our sales reps into Netsuite, but any time the customer orders online, the script does not do what it's intended to. It's a basic thing, I just need a custom field populated with Blind Ship instructions for this specific customer. Here's the script:
function afterSubmit(type) { var recSO = nlapiGetNewRecord(); var intID = recSO.getId(); if (type == 'create') { var recSalesOrder = nlapiLoadRecord('salesorder', intID); var stCustomer = recSalesOrder.getFieldText('entity'); nlapiLogExecution('DEBUG', 'CustID', stCustomer); if (stCustomer == 'customer name'){ recSalesOrder.setFieldValue('custbody1', 'BLIND SHIP. Do not include packing slip or invoice.') } var intOrderID = nlapiSubmitRecord(recSalesOrder, true); nlapiLogExecution('DEBUG', 'Order ID', intOrderID); } }I've tried running this in multiple ways, but I am pretty frustrated at the lack of customization allowed by Netsuite in the checkout area of a web store.Any ideas as to how to get this to work or a different way of accomplishing the same on a web order would be very much appreciated!