Skip to content

Adding Drop Ship PO to Existing Sales Order in NetSuite

I’m needing to create drop ship purchase orders against sales orders within NetSuite that already exist and have one or more drop ship POs created against it. Now, normally through the UI you can just click the “Drop Ship” link on an item line and there you go, but this is being done programmatically with SuiteScript. I thought I had this figured out years ago, but it was years ago, this hasn’t come up since, and I can no longer remember what files I may have been working on at the time.

The system won’t allow reverting the order to a “Pending Approval” status, so I can’t just change statuses around to force the system to create the new POs. I’ve also tried the following to no success:

soRecord.setCurrentLineItemValue("item", "createpo", "DropShip");
soRecord.setCurrentLineItemValue("item", "povendor", vendorId);

Nothing happens aside from adding the new item lines to the sales order. I’ve also tried creating a PO with the appropriaate vendor and attaching it to the item line on the sales order with the following, but it also has no effect:

soRecord.setCurrentLineItemValue("item", "createdpo", poId);

Is there something I’m missing? Or have I been embarking on a fool’s errand the entire time?

Answer

Those fields are read only. This is what I used

var po = nlapiCreateRecord('purchaseorder', {recordmode:"dynamic", soid:<internal id of salesorder>,poentity:<preferred vendor of item>});