ec
06/05/2023, 7:55 PM{
"type": "error.SuiteScriptError",
"name": "SSS_MISSING_REQD_ARGUMENT",
"message": "line",
"stack": [
"nlapiCreateError(NLRecordScripting.scriptInit:1499)",
"nsapiAssertTrue(NLRecordScripting.scriptInit:2326)",
"nsapiCheckArgs(NLRecordScripting.scriptInit:2300)",
"nlapiRemoveLineItem(NLRecordScripting.scriptInit:1844)",
"removeAllItemLines(NLRecordScripting.scriptInit:8207)",
"syncItemMachine(NLRecordScripting.scriptInit:8189)",
"page_init(NLRecordScripting.scriptInit:8241)",
"(N/record/recordService.js)",
"onRequest(/SuiteScripts/.../testSL.js:58)"
],
"cause": {
"type": "internal error",
"code": "SSS_MISSING_REQD_ARGUMENT",
"details": "line",
"userEvent": null,
"stackTrace": [
"nlapiCreateError(NLRecordScripting.scriptInit:1499)",
"nsapiAssertTrue(NLRecordScripting.scriptInit:2326)",
"nsapiCheckArgs(NLRecordScripting.scriptInit:2300)",
"nlapiRemoveLineItem(NLRecordScripting.scriptInit:1844)",
"removeAllItemLines(NLRecordScripting.scriptInit:8207)",
"syncItemMachine(NLRecordScripting.scriptInit:8189)",
"page_init(NLRecordScripting.scriptInit:8241)",
"(N/record/recordService.js)",
"onRequest(/SuiteScripts/.../testSL.js:58)"
],
"notifyOff": false
},
"id": "",
"notifyOff": false,
"userFacing": false
}
Pasting code within thread because I know @battk will ask for it!ec
06/05/2023, 7:56 PM/**
* @NApiVersion 2.0
* @NScriptType Suitelet
* @NModuleScope Public
*/
define(['N/record'], function (record) {
return { onRequest: onRequest };
function onRequest() {
log.debug('start', new Date());
var REC = record.create({
type: record.Type.SALES_ORDER,
defaultValues: {
ictran: 658260,
entity: 5109,
subsidiary: 32,
currency: 1
}
});
var pairedICPO = 658260;
var fieldMapping = {
entity: "5109",
subsidiary: "32",
location: "23",
class: "1", //Brand
department: "19", //Cost of Sales : Direct COGS
currency: 1,
//intercostatus: 2,
//intercotransaction: 658260
};
var itemLines = {
item: "6651",
location: "23",
quantity: "1",
rate: "10.95",
};
util.each(fieldMapping, function (value, fieldId) {
REC.setValue({ fieldId: fieldId, value: value });
});
log.debug('before', REC.getLineCount({ sublistId: 'item' }));
util.each(itemLines, function (value, fieldId) {
REC.setSublistValue({ fieldId: fieldId, value: value, sublistId: 'item', line: 0 });
});
log.debug('after', REC.getLineCount({ sublistId: 'item' }));
var id = REC.save({ ignoreMandatoryFields: true, enableSourcing: false });
log.debug(id);
}
});
ec
06/05/2023, 7:59 PMNathan L
06/05/2023, 8:07 PMNathan L
06/05/2023, 8:07 PMNathan L
06/05/2023, 8:07 PMNathan L
06/05/2023, 8:08 PMNathan L
06/05/2023, 8:09 PMec
06/05/2023, 8:35 PMec
06/05/2023, 8:38 PMec
06/05/2023, 8:42 PMYou changed the paired intercompany transaction associated with this transaction. Click OK to replace the items on this transaction with the items from the paired intercompany transaction. Click Cancel to add the items from the paired intercompany transaction to this transaction.
Nathan L
06/05/2023, 8:42 PMec
06/05/2023, 8:42 PMbattk
06/05/2023, 11:25 PMbattk
06/05/2023, 11:26 PMec
06/05/2023, 11:26 PMbattk
06/05/2023, 11:26 PMec
06/05/2023, 11:26 PMbattk
06/05/2023, 11:28 PMignoreMandatoryFields
battk
06/05/2023, 11:28 PMbattk
06/05/2023, 11:28 PMenableSourcing
may be an option you may want to trybattk
06/05/2023, 11:29 PMbattk
06/05/2023, 11:29 PMec
06/05/2023, 11:30 PMec
06/05/2023, 11:30 PMbattk
06/05/2023, 11:32 PMbattk
06/05/2023, 11:32 PMbattk
06/05/2023, 11:33 PMec
06/05/2023, 11:35 PMYou can manually create a paired intercompany sales order *only* if the order does not contain an inventory item.
ec
06/05/2023, 11:36 PMbattk
06/05/2023, 11:38 PMbattk
06/05/2023, 11:38 PMbattk
06/05/2023, 11:38 PMec
06/05/2023, 11:38 PMbattk
06/05/2023, 11:38 PMec
06/05/2023, 11:38 PMec
06/05/2023, 11:39 PMbattk
06/05/2023, 11:42 PMbattk
06/05/2023, 11:42 PMec
06/05/2023, 11:43 PMbattk
06/05/2023, 11:43 PMec
06/05/2023, 11:43 PMec
06/05/2023, 11:43 PMec
06/05/2023, 11:44 PMbattk
06/05/2023, 11:56 PMbattk
06/05/2023, 11:57 PMbattk
06/05/2023, 11:58 PMrequire(["N/record"], function (record) {
var itemLines = {
item: "5",
quantity: "1",
rate: "1",
};
var purchaseOrder = record.create({
type: record.Type.PURCHASE_ORDER,
defaultValues: {
entity: "10",
},
});
purchaseOrder.setValue({ fieldId: "location", value: "1" });
util.each(itemLines, function (value, fieldId) {
purchaseOrder.setSublistValue({
fieldId: fieldId,
value: value,
sublistId: "item",
line: 0,
});
});
var purchaseOrderId = purchaseOrder.save();
log.debug(purchaseOrderId);
var salesOrder = record.create({
type: record.Type.SALES_ORDER,
defaultValues: {
ictran: purchaseOrderId,
entity: 9,
subsidiary: 3,
currency: 1,
},
});
util.each(itemLines, function (value, fieldId) {
salesOrder.setSublistValue({
fieldId: fieldId,
value: value,
sublistId: "item",
line: 0,
});
});
var salesOrderId = salesOrder.save();
log.debug(salesOrderId);
});
ec
06/06/2023, 2:09 PMbattk
06/06/2023, 3:00 PMec
06/06/2023, 7:40 PMec
06/06/2023, 8:06 PMsyncItemMachine
which seems like this is the source of the issue (or further down the line - removeAllLines
, etc) somewhere along the ālinesā it is missing a reference to a line number.
It is a bit odd what is occurring behind the scenes because when I simply log the line count, it is 1 before I even set values on the line.
Something funky is happening, but no I cannot even get the standard non inventory SO to generate hereā¦battk
06/06/2023, 8:11 PMbattk
06/06/2023, 8:11 PMec
06/06/2023, 8:12 PMec
06/06/2023, 8:12 PMec
06/06/2023, 8:14 PMbattk
06/06/2023, 8:17 PMec
06/06/2023, 8:17 PMec
06/06/2023, 8:33 PMec
06/07/2023, 7:03 PMdefaultValues
. Rather, I set them all via setValue
calls.
So, now when I try with Inventory PO => SO, I am stuck as I get failures when I attempt to not use the defaultValues
parameter. Specifically, the intercotransaction cannot be set (much like in the UI); when I use defaultValues
ONLY for the single parameter (ictran
), I get a weird message that this item cannot be added to the order immediately on the record.create
call.ec
06/07/2023, 7:34 PM{
"type": "error.SuiteScriptError",
"name": "SSS_MISSING_REQD_ARGUMENT",
"message": "line",
"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.onRequest (/SuiteScripts/.../....js:112:39)"
],
"cause": {
"type": "internal error",
"code": "SSS_MISSING_REQD_ARGUMENT",
"details": "line",
"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.onRequest (/SuiteScripts/.../....js:112:39)"
],
"notifyOff": false
},
"notifyOff": false,
"userFacing": true
}
battk
06/08/2023, 2:34 AMbattk
06/08/2023, 2:34 AMec
06/08/2023, 1:50 PM