We have a UE script that should copy the value of a custom field from the inbound shipment to the custom field of the item receipt.
And we're getting this error after submitting the IR from Receive Inbound Shipments page:
{"type":"error.SuiteScriptError","name":"SSS_MISSING_REQD_ARGUMENT","message":"load: Missing a required argument: id","stack":["createError(N/error)","beforeSubmit(/SuiteScripts/copyConNum_UE.js:18)","createError(N/error)"],"cause":{"name":"SSS_MISSING_REQD_ARGUMENT","message":"load: Missing a required argument: id"},"id":"","notifyOff":false,"userFacing":true}
The script is here:
define(['N/record'], function(record) {
function beforeSubmit(context) {
var rec = context.newRecord;
var inbShipId = rec.getValue({
fieldId: 'inboundshipment'
});
log.debug('inbShipId', inbShipId);
var inbShip = record.load({
type: record.Type.INBOUND_SHIPMENT,
id: inbShipId,
});
var containerNum = inbShip.getValue({
fieldId: 'custrecord_container_number'
});
log.debug('containerNum', containerNum);
rec.setValue({
fieldId: 'custbody_container_number',
value: containerNum
});
}
return {
beforeSubmit: beforeSubmit
};
});