Normally, serial number could be accessed via nlapiGetFieldValue on the transaction record.
However when Advanced Bin/Numbered Inventory Management was enabled for the account, serial / lot numbers is being considered as subrecords of item fulfillment.
To get the value of the serial number using script, kindly refer to the snippet below :
var fulID = nlapiGetRecordId();
var rec = nlapiLoadRecord('itemfulfillment', fulID); //fulID will be the internal id of the Item Fulfillment record retrieved from nlapiGetRecordId
var subrec = rec.viewLineItemSubrecord('item', 'inventorydetail', 1); //would get the inventory detail record on the line number on the fulfillment
var x = subrec.getLineItemValue('inventoryassignment','quantity',1); //would get the quantity of the inventory detail
var x1 = subrec.getLineItemValue('inventoryassignment','issueinventorynumber',1); //would return the inventory number record on the indicated line item.
//In case that you need the actual serial number
var serialnum = nlapiLoadRecord('inventorynumber', x1); // loading the inventory number record from the fulfillment subrecord.
var serialname = serialnum.getFieldValue('inventorynumber'); //will return the actual serial number of the inventory number
Users can send the serial numbers from the email or store it on a custom multiselect field inside the fulfillment record.
No comments:
Post a Comment