Chris
08/04/2023, 6:46 PM{
"type": "error.SuiteScriptError",
"name": "USER_ERROR",
"message": "Please configure the inventory detail in line 1 of the item list.",
"id": "",
"stack": [
"Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at Object.updateSO (/SuiteScripts/lzft_lib_copyValueSOWO.js:110:18)\n at Object.reduce (/SuiteScripts/CSL_CopyValue_WO_SO_MR.js:50:38)"
],
"cause": {
"type": "internal error",
"code": "USER_ERROR",
"details": "Please configure the inventory detail in line 1 of the item list.",
"userEvent": null,
"stackTrace": [
"Error\n at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n at NetSuiteObject.thenableFunction() (suitescript/resources/javascript/record/proxy.js:115:24)\n at Object.updateSO (/SuiteScripts/lzft_lib_copyValueSOWO.js:110:18)\n at Object.reduce (/SuiteScripts/CSL_CopyValue_WO_SO_MR.js:50:38)"
],
"notifyOff": false
},
"notifyOff": false,
"userFacing": true
}
meaning if the SO has line level details that have inventory details attached to it, the script can’t move down to copy other lines on that SO.
1.) Has anyone else run into this issue and found a creative solve to ’jump’skip the lines that have item details already?
Example attached where the below fields have item details assigned to it which prevents the script from updating the top line
/**
*@NApiVersion 2.1
*@NScriptType MapReduceScript
*/
define(['N/record', 'N/search','./lzft_lib_copyValueSOWO.js'], function(record, search,libCopyValueSOWO) {
function getInputData() {
return search.load({
id: 'customsearch6788'
});
}
function map(context) {
var logTitle = 'map';
try {
log.debug('context', context)
var recInfo = JSON.parse(context.value)['values'];
context.write({
key: recInfo['applyingtransaction']['value'],
value: context.value
});
} catch ( error ) {
errorOut(error, logTitle);
log.error(logTitle, context.value);
}
}
function reduce(context) {
try {
var newRecord = record.load({
type: 'workorder',
id: context.key
});
let createdFrom = newRecord.getValue({
fieldId: "createdfrom",
});
log.debug("created from" + createdFrom);
if (createdFrom) {
let newOSD = newRecord.getValue({
fieldId: "custbodycs_so_eta",
});
let newCRD = newRecord.getValue({
fieldId: "custbody_promisedate",
});
let tranType = libCopyValueSOWO.getTransactionType(createdFrom);
log.debug("tran type" + tranType);
if (tranType == "salesorder") {
libCopyValueSOWO.updateSO(
newRecord.id,
createdFrom,
newCRD,
newOSD
);
}
}
} catch (e) {
log.debug('error', e);
}
}
function summarize(summary) {
log.debug({
title: 'Script Complete',
details: 'Processed ' + summary.inputSummary.total + ' sales orders.'
});
}
function errorOut(error, logTitle) {
if (error.message != undefined) {
log.error(logTitle, error.name + ' : ' + error.message);
}
else {
log.error(logTitle, error.toString());
}
}
return {
getInputData: getInputData,
map: map,
reduce: reduce,
summarize: summarize
}
});
Ask AI to edit or generate...
Shawn Talbert
08/04/2023, 7:38 PMbattk
08/05/2023, 4:42 AMlzft_lib_copyValueSOWO.js
is where your error is coming, from, its where you want to start looking for problems