Sim Greenbaum
08/10/2022, 6:45 PMvar quantity = bill.getSublistValue({
sublistId: "item",
fieldId: "custcol6",
line: i,
});
Marvin
08/10/2022, 7:07 PMisDynamic: false
. Otherwise you need to use bill.getCurrentSublistValue()
.
https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4273170578.html
https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4273166148.htmlSim Greenbaum
08/10/2022, 7:10 PMinboundShipment.setSublistValue({
sublistId: "items",
fieldId: "purchaseorder",
value: the value,
line: i,
});
Marvin
08/10/2022, 7:34 PMinternalid
of the record.Sim Greenbaum
08/10/2022, 7:35 PMMarvin
08/10/2022, 7:36 PMSim Greenbaum
08/10/2022, 7:37 PMMarvin
08/10/2022, 7:40 PMSim Greenbaum
08/10/2022, 7:42 PMMarvin
08/10/2022, 7:44 PMUnexpected error
.Sim Greenbaum
08/10/2022, 7:44 PMSim Greenbaum
08/10/2022, 7:44 PMSim Greenbaum
08/10/2022, 7:53 PMMarvin
08/10/2022, 7:54 PMSim Greenbaum
08/10/2022, 8:07 PM"You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.",
Sim Greenbaum
08/10/2022, 8:47 PMmessage: "Invalid shipmentitem reference key 32880932."
Sim Greenbaum
08/10/2022, 8:49 PMMarvin
08/10/2022, 8:58 PMSim Greenbaum
08/10/2022, 9:00 PMMarvin
08/10/2022, 9:03 PMSim Greenbaum
08/10/2022, 9:09 PMlineuniquekey of purchase order line item NOT intenal id of item or lineuniquekey from line of bill
Sim Greenbaum
08/10/2022, 9:10 PMbattk
08/10/2022, 10:14 PMSim Greenbaum
08/11/2022, 2:37 AMfor (var i = 0; i <= itemLineCount; i++) {
var item = bill.getSublistValue({
sublistId: "item",
fieldId: "item",
line: i,
});
var quantity = bill.getSublistValue({
sublistId: "item",
fieldId: "quantity",
line: i,
});
// var lineuniquekey = bill.getSublistValue({
// sublistId: "item",
// fieldId: "lineuniquekey",
// line: i,
// });
var ppnum = bill.getSublistValue({
sublistId: "item",
fieldId: "orderdoc",
line: i,
});
var pcustcol6 = bill.getSublistValue({
sublistId: "item",
fieldId: "custcol6",
line: i,
});
let POid = parseInt(ppnum);
let itemId = parseInt(item);
log.debug(typeof ppnum, {
ppnum,
pcustcol6,
POid,
itemId,
item,
});
inboundShipment.selectNewLine({
sublistId: "items",
});
inboundShipment.setCurrentSublistValue({
sublistId: "items",
fieldId: "purchaseorder",
value: POid,
});
inboundShipment.setCurrentSublistValue({
sublistId: "items",
fieldId: "shipmentitem",
value: "31454852",
});
inboundShipment.commitLine({
sublistId: "items",
});
Sim Greenbaum
08/11/2022, 2:38 AMvar inboundShipment = record.create({
type: record.Type.INBOUND_SHIPMENT,
isDynamic: true,
});
var bill = record.load({
type: record.Type.VENDOR_BILL,
id: id,
isDynamic: false,
});
Sim Greenbaum
08/11/2022, 2:39 AMbattk
08/11/2022, 3:16 AMbattk
08/11/2022, 3:20 AMSim Greenbaum
08/11/2022, 1:38 PMSim Greenbaum
08/11/2022, 1:44 PMbattk
08/11/2022, 2:17 PMfor (var i = 0; i <= itemLineCount; i++)
battk
08/11/2022, 2:17 PMSim Greenbaum
08/11/2022, 2:20 PMfor (var i = 0; i < itemLineCount; i++)
Sim Greenbaum
08/11/2022, 2:27 PM"Invalid shipmentitem reference key 26777."
battk
08/11/2022, 2:28 PMbattk
08/11/2022, 2:29 PMSim Greenbaum
08/11/2022, 2:32 PMSim Greenbaum
08/11/2022, 2:32 PM`/**
* @NApiVersion 2.1
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define(["N/record"], function (record) {
function pageInit() {
console.log("pageInit");
}
//seearch for inbound shipment before create then items on bill
function createinbound() {
try {
/// skip if status of bill is wrong //
var id = document.forms["main_form"].id.value;
var inboundShipment = record.create({
type: record.Type.INBOUND_SHIPMENT,
isDynamic: true,
});
var bill = record.load({
type: record.Type.VENDOR_BILL,
id: id,
isDynamic: false,
});
let vendor = bill.getValue({ fieldId: "entityname" });
let container = bill.getValue({ fieldId: "custbody4" });
let entry_number = bill.getValue({ fieldId: "custbody34" });
let oceanbol = bill.getValue({ fieldId: "custbody33" });
let bol = bill.getValue({ fieldId: "custbody8" });
let fda_pedgree = bill.getValue({ fieldId: "custbody5" });
let fda_status = bill.getValue({ fieldId: "custbody32" });
log.debug({ container, oceanbol, bol });
inboundShipment.setValue({
fieldId: "billoflading",
value: bol,
});
inboundShipment.setValue({
fieldId: "custrecord154",
value: oceanbol,
});
// inboundShipment.setValue({
// fieldId: "custrecord145",
// value: fda_status,
// });
inboundShipment.setValue({
fieldId: "custrecord149",
value: container,
});
inboundShipment.setValue({
fieldId: "billoflading",
value: bol,
});
// inboundShipment.setValue({
// fieldId: "custrecord152",
// value: vendor,
// });
inboundShipment.setValue({
fieldId: "shipmentmemo",
value: entry_number,
});
var itemLineCount = bill.getLineCount({
sublistId: "item",
});
for (var i = 0; i < itemLineCount; i++) {
var item = bill.getSublistValue({
sublistId: "item",
fieldId: "item",
line: i,
});
var quantity = bill.getSublistValue({
sublistId: "item",
fieldId: "quantity",
line: i,
});
// var lineuniquekey = bill.getSublistValue({
// sublistId: "item",
// fieldId: "lineuniquekey",
// line: i,
// });
var ppnum = bill.getSublistValue({
sublistId: "item",
fieldId: "orderdoc",
line: i,
});
var pcustcol6 = bill.getSublistValue({
sublistId: "item",
fieldId: "custcol6",
line: i,
});
let POid = parseInt(ppnum);
let itemId = parseInt(item);
log.debug(typeof ppnum, {
ppnum,
pcustcol6,
POid,
itemId,
item,
});
inboundShipment.selectNewLine({
sublistId: "items",
});
inboundShipment.setCurrentSublistValue({
sublistId: "items",
fieldId: "purchaseorder",
value: POid,
});
inboundShipment.setCurrentSublistValue({
sublistId: "items",
fieldId: "shipmentitem",
value: itemId,
});
inboundShipment.commitLine({
sublistId: "items",
});
}
log.debug("test", "this line fails");
battk
08/11/2022, 2:36 PMSim Greenbaum
08/11/2022, 2:36 PMbattk
08/11/2022, 2:37 PMbattk
08/11/2022, 2:37 PMSim Greenbaum
08/11/2022, 2:37 PMbattk
08/11/2022, 2:37 PMSim Greenbaum
08/11/2022, 2:38 PMbattk
08/11/2022, 2:39 PMSim Greenbaum
08/11/2022, 2:40 PMbattk
08/11/2022, 2:43 PMbattk
08/11/2022, 2:44 PMbattk
08/11/2022, 2:44 PMSim Greenbaum
08/11/2022, 2:44 PMbattk
08/11/2022, 2:44 PMbattk
08/11/2022, 2:44 PMSim Greenbaum
08/11/2022, 2:44 PMbattk
08/11/2022, 2:44 PMbattk
08/11/2022, 2:44 PMSim Greenbaum
08/11/2022, 2:45 PMbattk
08/11/2022, 2:45 PMbattk
08/11/2022, 2:45 PMbattk
08/11/2022, 2:46 PMSim Greenbaum
08/11/2022, 2:47 PMSim Greenbaum
08/11/2022, 2:47 PMbattk
08/11/2022, 2:52 PMbattk
08/11/2022, 2:52 PMSim Greenbaum
08/11/2022, 3:00 PMshipmentitem: {
legacyStringValue: "32654346"
},
shipmentitem_display: {
legacyStringValue: "583300"
},
Sim Greenbaum
08/11/2022, 3:01 PMbattk
08/11/2022, 3:01 PMbattk
08/11/2022, 3:01 PMbattk
08/11/2022, 3:01 PMSim Greenbaum
08/11/2022, 3:18 PMlineuniquekey:"26741487"
battk
08/11/2022, 3:34 PMSim Greenbaum
08/11/2022, 3:36 PMbattk
08/11/2022, 3:40 PMSim Greenbaum
08/11/2022, 3:51 PMSim Greenbaum
08/11/2022, 4:03 PMbattk
08/11/2022, 4:21 PMbattk
08/11/2022, 4:21 PMSim Greenbaum
08/11/2022, 4:22 PMbattk
08/11/2022, 4:22 PMbattk
08/11/2022, 4:22 PMSim Greenbaum
08/11/2022, 4:22 PMbattk
08/11/2022, 4:23 PMbattk
08/11/2022, 4:23 PMSim Greenbaum
08/11/2022, 4:24 PMbattk
08/11/2022, 4:24 PMbattk
08/11/2022, 4:24 PMSim Greenbaum
08/11/2022, 4:25 PMvar bill = record.load({
type: record.Type.VENDOR_BILL,
id: id,
isDynamic: false,
});
Sim Greenbaum
08/11/2022, 4:25 PMbattk
08/11/2022, 4:47 PMbattk
08/11/2022, 4:48 PMSim Greenbaum
08/11/2022, 4:49 PMSim Greenbaum
08/11/2022, 4:50 PMvar ppnum = bill.getSublistValue({
sublistId: "item",
fieldId: "orderdoc",
line: i,
});
battk
08/11/2022, 4:52 PMSim Greenbaum
08/11/2022, 4:53 PMbattk
08/11/2022, 4:53 PMSim Greenbaum
08/12/2022, 3:04 PMbattk
08/12/2022, 3:07 PMSim Greenbaum
08/12/2022, 3:07 PMSim Greenbaum
08/12/2022, 3:10 PMSim Greenbaum
08/12/2022, 3:19 PMbattk
08/12/2022, 3:20 PMSim Greenbaum
08/12/2022, 3:22 PMbattk
08/12/2022, 3:23 PMSim Greenbaum
08/15/2022, 7:40 PMlet myCustomerQuery = query.create({
type: query.Type.TRANSACTION,
});
let joincopponent = myCustomerQuery.autoJoin({
fieldId: "transactionLines",
});
// let podata = joincopponent.autoJoin({ fieldId: "orderdoc" });
myCustomerQuery.condition = myCustomerQuery.and(
myCustomerQuery.createCondition({
fieldId: "id",
operator: query.Operator.EQUAL,
values: id,
}),
myCustomerQuery.createCondition({
fieldId: "custbody31",
operator: <http://query.Operator.IS|query.Operator.IS>,
values: true,
})
)
Marvin
08/15/2022, 7:43 PMmyCustomerQuery.columns = [
myCustomerQuery.createColumn({
fieldId: 'transactionlines.quantity'
})
]
You can pull those ID's out of analytics when you are interacting with the dataset by clicking on the information icon next to the field you want to use.Sim Greenbaum
08/15/2022, 7:48 PMMarvin
08/15/2022, 7:51 PMtransactionlines.quantity
syntax in the field id.Marvin
08/15/2022, 7:52 PMSim Greenbaum
08/15/2022, 7:52 PMSim Greenbaum
08/15/2022, 7:54 PMbattk
08/15/2022, 8:17 PMbattk
08/15/2022, 8:18 PMMarvin
08/15/2022, 8:18 PMSim Greenbaum
08/15/2022, 8:21 PMMarvin
08/15/2022, 8:59 PMSim Greenbaum
08/15/2022, 9:35 PMbattk
08/15/2022, 9:38 PMSim Greenbaum
08/15/2022, 9:39 PMSim Greenbaum
08/16/2022, 4:33 PMSim Greenbaum
08/16/2022, 5:53 PMSELECT
transaction.ID as transaction_id,
transactionLine.ID as transactionLine_id,
transactionLine.item as item_id,
transactionLine.custcol6 as po_number,
FROM transaction
JOIN transactionLine ON transaction.ID = transactionLine.transaction
WHERE transaction.ID = 13636399 AND transactionLine.item IS NOT NULL
Marvin
08/16/2022, 6:28 PMSim Greenbaum
08/16/2022, 6:40 PMbattk
08/16/2022, 8:34 PMbattk
08/16/2022, 8:34 PMSim Greenbaum
08/16/2022, 8:35 PMSim Greenbaum
08/16/2022, 8:48 PMSELECT
transaction.ID as transaction_id,
transactionLine.ID as transactionLine_id,
transactionLine.item as item_id,
transactionLine.custcol6 as po_number,
PreviousTransactionLineLink.previousdoc
FROM transaction
JOIN transactionLine ON transaction.ID = transactionLine.transaction
JOIN PreviousTransactionLineLink ON PreviousTransactionLineLink.nextline = transactionLine.id AND
PreviousTransactionLineLink.nextdoc = transactionLine.transaction
WHERE transaction.ID = 13636399 AND transactionLine.item IS NOT NULL
battk
08/16/2022, 9:21 PMbattk
08/16/2022, 9:22 PMSim Greenbaum
08/16/2022, 9:23 PMbattk
08/16/2022, 9:24 PMSim Greenbaum
08/16/2022, 9:24 PMbattk
08/16/2022, 9:25 PMbattk
08/16/2022, 9:25 PMbattk
08/16/2022, 9:25 PMSim Greenbaum
08/16/2022, 9:26 PMbattk
08/16/2022, 9:28 PMSim Greenbaum
08/16/2022, 9:29 PMSim Greenbaum
08/17/2022, 2:12 PMbattk
08/17/2022, 7:20 PMSim Greenbaum
08/17/2022, 7:24 PMbattk
08/17/2022, 7:28 PMSim Greenbaum
08/18/2022, 5:16 PMSim Greenbaum
08/18/2022, 5:16 PMSELECT
transactionLine.transaction,
transactionLine.memo,
transactionLine.item as item_id,
transactionLine.uniquekey,
transactionLine.quantityonshipments
FROM transactionLine
INNER JOIN NextTransactionLineLink ON
NextTransactionLineLink.previousline = transactionLine.id AND
NextTransactionLineLink.previousdoc = transactionLine.transaction
WHERE NextTransactionLineLink.nextdoc = 13636399