Description
The all inventory item changed to serialised inventory item.
Update the “isserialised” to true in all inventory item record
/**
* @NApiVersion 2.x
* @NScriptType MassUpdateScript
* @NModuleScope SameAccount
*
*/
define(['N/record', 'N/search'],
function(record, search) {
/**
* Definition of Mass Update trigger point.
*
* @param {Object} params
* @param {string} params.type - Record type of the record being processed by the mass update
* @param {number} params.id - ID of the record being processed by the mass update
*
* @since 2016.1
*/
function each(params) {
try {
log.debug("params.key", params);
var objRecord = record.load({
type: record.Type.INVENTORY_ITEM,
id: params.values[0],
isDynamic: false,
});
objRecord.setValue({
fieldId: 'isserialitem',
value: true
})
var recordId = objRecord.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
log.debug("recordId", recordId);
} catch (e) {
log.debug({
title: 'error',
details: e.message
});
}
}
return {
reduce: each,
getInputData: function() {
return [
/*ENTER THE RECORDS WITH NEED THIS*/
]
},
summarize: function(context) {
log.debug("context", context);
}
};
});