Sunday, December 23, 2018

Transform a Sales Order to Item Fulfillment with Inventory Detail via SuiteScript

This demonstrates how you can transform a Sales Order into an Item Fulfillment record then add an Inventory Detail the fulfillment. On this sample, take note that there is no Inventory Detail indicated on the Sales Order. The item is a Lot Numbered Inventory Item on Bins. This also applies to Serialized Inventory Items.
Here is a snippet:
var ifRec = nlapiTransformRecord('salesorder', 6199, 'itemfulfillment');

ifRec.selectLineItem('item', 1);
ifRec.setCurrentLineItemValue('item', 'location', 1);

var ifDetail = ifRec.createCurrentLineItemSubrecord('item', 'inventorydetail');
ifDetail.setCurrentLineItemValue('inventoryassignment', 'issueinventorynumber', 25); //lot number's Internal ID
ifDetail.setCurrentLineItemValue('inventoryassignment', 'binnumber', 1); //bin number's Internal ID
ifDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', 1);


var ifID = nlapiSubmitRecord(ifRec);

1 comment:

  1. Is this a Client Script or a Restlet? Is this in SuiteScript 2.0?