diff --git a/src/FileCabinet/SuiteScripts/InventoryTransfer/HC_MR_ExportedInventoryTransferCSV.js b/src/FileCabinet/SuiteScripts/InventoryTransfer/HC_MR_ExportedInventoryTransferCSV.js index a54f87c..f53d94c 100644 --- a/src/FileCabinet/SuiteScripts/InventoryTransfer/HC_MR_ExportedInventoryTransferCSV.js +++ b/src/FileCabinet/SuiteScripts/InventoryTransfer/HC_MR_ExportedInventoryTransferCSV.js @@ -4,6 +4,17 @@ */ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/error', 'N/task'], (file, record, search, sftp, error, task) => { + const internalIdList = new Set([]); + + const checkInternalId = (internalid) => { + if (internalIdList.has(internalid)) { + return false; + } else { + internalIdList.add(internalid); + return true; + } + } + const getInputData = (inputContext) => { // Get item receipt search query var inventoryTransferSearch = search.load({ id: 'customsearch_hc_exp_wh_inv_transfer' }); @@ -21,13 +32,16 @@ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/error', 'N/task'], var comments = "Inventory Adjusted from Inventory Transfer # " + internalid + " in NetSuite "; if (internalid) { - var id = record.submitFields({ - type: record.Type.INVENTORY_TRANSFER, - id: internalid, - values: { - custbody_hc_inventory_transfer_exp: true - } - }); + var checkId = checkInternalId(internalid); + if (checkId) { + var id = record.submitFields({ + type: record.Type.INVENTORY_TRANSFER, + id: internalid, + values: { + custbody_hc_inventory_transfer_exp: true + } + }); + } } var inventoryDeltaData = { diff --git a/src/FileCabinet/SuiteScripts/ItemReceipt/HC_MR_ExportedItemReceiptCSV.js b/src/FileCabinet/SuiteScripts/ItemReceipt/HC_MR_ExportedItemReceiptCSV.js index 57292a9..32624b8 100644 --- a/src/FileCabinet/SuiteScripts/ItemReceipt/HC_MR_ExportedItemReceiptCSV.js +++ b/src/FileCabinet/SuiteScripts/ItemReceipt/HC_MR_ExportedItemReceiptCSV.js @@ -4,6 +4,17 @@ */ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/task', 'N/error'], (file, record, search, sftp, task, error) => { + const internalIdList = new Set([]); + + const checkInternalId = (internalid) => { + if (internalIdList.has(internalid)) { + return false; + } else { + internalIdList.add(internalid); + return true; + } + } + const getInputData = (inputContext) => { // Get item receipt search query var itemReceiptSearch = search.load({ id: 'customsearch_hc_export_wh_item_receipt' }); @@ -21,13 +32,16 @@ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/task', 'N/error'], var comments = "Inventory Adjusted from ItemReceipt # " + internalid + " in NetSuite "; if (internalid) { - var id = record.submitFields({ - type: record.Type.ITEM_RECEIPT, - id: internalid, - values: { - custbody_hc_receipt_exported: true - } - }); + var checkId = checkInternalId(internalid); + if (checkId) { + var id = record.submitFields({ + type: record.Type.ITEM_RECEIPT, + id: internalid, + values: { + custbody_hc_receipt_exported: true + } + }); + } } var itemReceiptData = { diff --git a/src/FileCabinet/SuiteScripts/SalesOrder/HC_MR_ExportedGiftCardFulfillmentCSV.js b/src/FileCabinet/SuiteScripts/SalesOrder/HC_MR_ExportedGiftCardFulfillmentCSV.js index 9d2427e..2c5ca11 100644 --- a/src/FileCabinet/SuiteScripts/SalesOrder/HC_MR_ExportedGiftCardFulfillmentCSV.js +++ b/src/FileCabinet/SuiteScripts/SalesOrder/HC_MR_ExportedGiftCardFulfillmentCSV.js @@ -4,6 +4,17 @@ */ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/error'], (file, record, search, sftp, error) => { + const internalIdList = new Set([]); + + const checkInternalId = (internalid) => { + if (internalIdList.has(internalid)) { + return false; + } else { + internalIdList.add(internalid); + return true; + } + } + const getInputData = (inputContext) => { // Get sales order fulfillment search query var salesOrderFulfillmentSearch = search.load({ id: 'customsearch_hc_exp_giftcard_fulfillment' }); @@ -25,14 +36,16 @@ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/error'], var shopifyOrderNumber = null; if (fulfillmentInternalId) { - - var id = record.submitFields({ - type: record.Type.ITEM_FULFILLMENT, - id: fulfillmentInternalId, - values: { - custbody_hc_gc_fulfillment_exported: true - } - }); + var checkId = checkInternalId(fulfillmentInternalId); + if (checkId) { + var id = record.submitFields({ + type: record.Type.ITEM_FULFILLMENT, + id: fulfillmentInternalId, + values: { + custbody_hc_gc_fulfillment_exported: true + } + }); + } var itemFulfillmentRecord = record.load({ type: record.Type.ITEM_FULFILLMENT, diff --git a/src/FileCabinet/SuiteScripts/SalesOrder/HC_MR_ExportedSalesOrderFulfillmentCSV.js b/src/FileCabinet/SuiteScripts/SalesOrder/HC_MR_ExportedSalesOrderFulfillmentCSV.js index b0bf2b2..f7aca04 100644 --- a/src/FileCabinet/SuiteScripts/SalesOrder/HC_MR_ExportedSalesOrderFulfillmentCSV.js +++ b/src/FileCabinet/SuiteScripts/SalesOrder/HC_MR_ExportedSalesOrderFulfillmentCSV.js @@ -4,6 +4,17 @@ */ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/task', 'N/error'], (file, record, search, sftp, task, error) => { + const internalIdList = new Set([]); + + const checkInternalId = (internalid) => { + if (internalIdList.has(internalid)) { + return false; + } else { + internalIdList.add(internalid); + return true; + } + } + const getInputData = (inputContext) => { // Get sales order fulfillment search query var salesOrderFulfillmentSearch = search.load({ id: 'customsearch_hc_export_so_fulfillment' }); @@ -39,13 +50,16 @@ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/task', 'N/error'], 'shippingMethodId': shippingMethodId }; if (fulfillmentInternalId) { - var id = record.submitFields({ - type: record.Type.ITEM_FULFILLMENT, - id: fulfillmentInternalId, - values: { - custbody_hc_fulfillment_exported: true - } - }); + var checkId = checkInternalId(fulfillmentInternalId); + if (checkId) { + var id = record.submitFields({ + type: record.Type.ITEM_FULFILLMENT, + id: fulfillmentInternalId, + values: { + custbody_hc_fulfillment_exported: true + } + }); + } } mapContext.write({ diff --git a/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedStoreTOFulfillmentCSV.js b/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedStoreTOFulfillmentCSV.js index fd45ab0..9da18d8 100644 --- a/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedStoreTOFulfillmentCSV.js +++ b/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedStoreTOFulfillmentCSV.js @@ -4,6 +4,17 @@ */ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/task', 'N/error'], (file, record, search, sftp, task, error) => { + const internalIdList = new Set([]); + + const checkInternalId = (internalid) => { + if (internalIdList.has(internalid)) { + return false; + } else { + internalIdList.add(internalid); + return true; + } + } + const getInputData = (inputContext) => { // Get item receipt search query var inventoryTransferSearch = search.load({ id: 'customsearch_hc_exp_store_to_fulfillment' }); @@ -53,14 +64,16 @@ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/task', 'N/error'], } } - - var id = record.submitFields({ - type: record.Type.ITEM_FULFILLMENT, - id: fulfillmentInternalId, - values: { - custbody_hc_fulfillment_exported: true - } - }); + var checkId = checkInternalId(fulfillmentInternalId); + if (checkId) { + var id = record.submitFields({ + type: record.Type.ITEM_FULFILLMENT, + id: fulfillmentInternalId, + values: { + custbody_hc_fulfillment_exported: true + } + }); + } } if (orderline) { var transferFulfillmentData = { diff --git a/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedStoreTransferOrderCSV.js b/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedStoreTransferOrderCSV.js index b7120db..1ca1ea1 100644 --- a/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedStoreTransferOrderCSV.js +++ b/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedStoreTransferOrderCSV.js @@ -5,6 +5,17 @@ define(['N/error', 'N/file', 'N/task', 'N/record', 'N/search', 'N/sftp'], (error, file, task, record, search, sftp) => { + const internalIdList = new Set([]); + + const checkInternalId = (internalid) => { + if (internalIdList.has(internalid)) { + return false; + } else { + internalIdList.add(internalid); + return true; + } + } + const getInputData = (inputContext) => { // Get StoreTransferOrder search query var StoreTransferOrderSearch = search.load({ id: 'customsearch_hc_exp_store_transfer_order' }); @@ -26,13 +37,16 @@ define(['N/error', 'N/file', 'N/task', 'N/record', 'N/search', 'N/sftp'], var transferOrderNumber = contextValues.values.tranid; if (internalid) { - var id = record.submitFields({ - type: record.Type.TRANSFER_ORDER, - id: internalid, - values: { - custbody_hc_order_exported: true - } - }); + var checkId = checkInternalId(internalid); + if (checkId) { + var id = record.submitFields({ + type: record.Type.TRANSFER_ORDER, + id: internalid, + values: { + custbody_hc_order_exported: true + } + }); + } } var storetransferorderdata = { diff --git a/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedWHTOFulfillmentCSV.js b/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedWHTOFulfillmentCSV.js index 6b1b84e..6fa31c4 100644 --- a/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedWHTOFulfillmentCSV.js +++ b/src/FileCabinet/SuiteScripts/TransferOrder/HC_MR_ExportedWHTOFulfillmentCSV.js @@ -4,6 +4,17 @@ */ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/task', 'N/error'], (file, record, search, sftp, task, error) => { + const internalIdList = new Set([]); + + const checkInternalId = (internalid) => { + if (internalIdList.has(internalid)) { + return false; + } else { + internalIdList.add(internalid); + return true; + } + } + const getInputData = (inputContext) => { // Get item receipt search query var inventoryTransferSearch = search.load({ id: 'customsearch_hc_exp_wh_to_fulfillment' }); @@ -53,14 +64,16 @@ define(['N/file', 'N/record', 'N/search', 'N/sftp', 'N/task', 'N/error'], } } - - var id = record.submitFields({ - type: record.Type.ITEM_FULFILLMENT, - id: fulfillmentInternalId, - values: { - custbody_hc_fulfillment_exported: true - } - }); + var checkId = checkInternalId(fulfillmentInternalId); + if (checkId) { + var id = record.submitFields({ + type: record.Type.ITEM_FULFILLMENT, + id: fulfillmentInternalId, + values: { + custbody_hc_fulfillment_exported: true + } + }); + } } if (orderline) { var transferFulfillmentData = {