Sim Greenbaum
08/09/2022, 6:05 PM/**
* @NApiVersion 2.1
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define(["N/record"], function (record) {
function pageInit() {
console.log("pageInit");
}
//let inboundshipmnet =bill.getValue({ fieldId: "custbody57" });
function createinbound() {
var id = document.forms["main_form"].id.value;
var inboundShipment = record.create({
type: record.Type.INBOUND_SHIPMENT,
isDynamic: false,
});
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" });
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 = 1; i <= itemLineCount; i++) {
// inboundShipment.selectNewLine({
// sublistId: 'items'
// });
// let
// po =bill.getSublistValue
// ({custcol6})
// inboundShipment.setCurrentSublistValue({
// sublistId: 'items',
// fieldId: 'purchaseorder',
// value: custcol6
// });
// inboundShipment.setCurrentSublistValue({
// sublistId: 'items',
// fieldId: 'shipmentitem',
// value: purchaseOrder.getSublistValue({
// sublistId: 'item',
// fieldId: 'lineuniquekey',
// line: i
// })
// });
// inboundShipment.commitLine({
// sublistId: 'items'
// });
// }
try {
var inboundShipmentId = inboundShipment.save({
enableSourcing: false,
ignoreMandatoryFields: false,
});
log.debug("te", inboundShipmentId);
} catch (error) {
log.debug("testerror", error);
}
}
return {
pageInit: pageInit,
createinbound: createinbound,
};
});