ANS-0342 · SUITESCRIPT DEVELOPMENT

How to Update Sales Order Status to Pending Fulfillment via Script

Learn how to programmatically change a NetSuite sales order's status to 'Pending Fulfillment' using SuiteScript.

Short answer

To programmatically approve a sales order in NetSuite, update the 'orderstatus' field to 'B' (Pending Fulfillment) using a SuiteScript function. While SuiteScript 1.0's nlapiSubmitField can achieve this, modern NetSuite development typically utilizes SuiteScript 2.0's N/record module for record manipulation.

Scenario

NetSuite users often need to automate the approval process for sales orders, moving them to a 'Pending Fulfillment' status without manual intervention. This is particularly useful in integration scenarios or when implementing custom approval workflows that require programmatic status updates.

Solution

To programmatically update a sales order's status to 'Pending Fulfillment', the orderstatus field must be set to 'B'. The status code 'B' specifically designates "Pending Fulfillment" in NetSuite.While SuiteScript 1.0 functions like nlapiSubmitField can achieve this, current NetSuite development primarily utilizes SuiteScript 2.0's N/record module for record manipulation.An example using SuiteScript 1.0:

javascriptnlapiSubmitField('salesorder',122765,'orderstatus','B');

In this example, 'salesorder' is the record type, 122765 is the internal ID of the sales order, and 'orderstatus' is the field being updated to 'B', which sets its status to "Pending Fulfillment". For SuiteScript 2.0, a similar operation would typically involve record.submitFields or record.load and record.save from the N/record module.

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant