Inventory

Explore the automated daily synchronization of inventory data from NetSuite to HotWax Commerce, ensuring real-time inventory updates.

NetSuite serves as the central system of record for tracking product inventories across various retail locations. Inventory transactions in Netsuite, encompassing the creation and reception of purchase orders (POs) in warehouses, as well as the fulfillment of online orders from these warehouses, are vital components for maintaining real-time and precise inventory records.

However, while HotWax Commerce receives frequent updates regarding online orders fulfilled from the warehouse using NetSuite, it does not receive regular updates on new inventory arrivals in the warehouses in response to purchase orders. This discrepancy causes HotWax Commerce to fall out of synchronization with inventory data of NetSuite.

To ensure that HotWax Commerce remains continually synchronized with the latest inventory information, the daily synchronization of inventory data is paramount. This synchronization process revolves around the extraction of inventory data from NetSuite and the subsequent update of HotWax Commerce's inventory records. This process is typically scheduled during off-peak hours, often taking place in the late hours of the night or in the early morning.

Key Objectives

  • Automate the daily synchronization of inventory data from Netsuite to HotWax Commerce.

  • Ensure that HotWax Commerce reflects the most recent inventory numbers, as recorded in NetSuite.

Workflow

  1. A Scheduled Script, equipped with the capability to utilize the Search Task from the N/task module, is executed. The objective of this script is to retrieve inventory records for all products stored within NetSuite. This is achieved through the execution of a saved search, specifically tailored for this purpose. Once the search is complete, the script generates a CSV file containing the inventory data and puts it within NetSuite's File Cabinet.

The Search Task function, utilized here, can generate and store a file solely within NetSuite's File Cabinet. It lacks the capability to place the file in an SFTP location. As a result, another scheduled script is necessary to accomplish this task.

SuiteScript

HC_generateCSV_InventoryItems
  1. A secondary Scheduled Script is triggered, which is responsible for retrieving the CSV file generated by the previous script from NetSuite's File Cabinet and subsequently relocating it to the designated SFTP location. An essential aspect to consider is that a 15-minute time gap is introduced between these two scripts. This delay is introduced to allow the asynchronous task, internally generated by NetSuite when executing the Search Task function of the N/Task module, to complete. Without this interval, the second script might run before the asynchronous task finishes, leading to an empty folder in NetSuite File Cabinet. This script not only transfers the files but also archives them from the NetSuite File Cabinet.

SuiteScript

HC_uploadCSV_InventoryItems

SFTP Locations

/home/{sftp.user}/netsuite/inventoryitem/csv
  1. The final step in the workflow involves a scheduled job within HotWax Commerce OMS. This job is responsible for reading the Inventory Sync CSV files from the SFTP location. It utilizes this data to reset the inventory numbers for products within the HotWax Commerce system.

Job in HotWax Commerce

Import inventory
FTP Config: RESET_INVENTORY

Why Search Task

In this particular use case, we have employed the Search Task function of the N/Task module for exporting inventory data from NetSuite. This approach is distinct from other scenarios where we utilized Map Reduce scripts and regular saved searches using the N/Search module. Our decision to implement Search Task for this specific purpose is based on our practical experience with various methods of exporting data from NetSuite, which revealed compelling reasons for this choice:

Handling Extensive Inventory Records

Initially, we attempted to synchronize inventory data from NetSuite to HotWax Commerce using Suite Script with a standard saved search through the N/Search module. However, this approach proved to be impractical when dealing with a high volume of inventory records. The script execution time exceeded the maximum threshold of one hour for Scheduled Scripts. NetSuite's documentation reinforced that SuiteScript is best suited for handling smaller data sets, making it evident that an alternative approach was required.

Efficiency of Map Reduce Scripts

Subsequently, we transitioned to Map Reduce scripts to manage the synchronization of inventory between NetSuite and HotWax Commerce. Map Reduce scripts are designed to handle large datasets efficiently and demonstrated significantly improved performance compared to Scheduled Scripts. Notably, even if the script execution extends beyond one hour, Map Reduce jobs are designed to manage NetSuite resources effectively, allowing them to complete the task. Based on our experience, processing a million inventory records required approximately two hours.

Harnessing SearchTask Function

To optimize the process and achieve rapid synchronization, we adopted Suite Script in combination with the Search Task function from the N/Task module. The results were remarkable, with the execution time reduced to a mere 10-15 seconds for a million inventory records. The search was executed swiftly, the CSV file was generated, and it was deposited in NetSuite's File Cabinet within a matter of seconds. This extraordinary speed and efficiency led us to the conclusion that the Search Task of the N/Task module was the ideal choice for synchronizing inventory records from NetSuite to HotWax Commerce.

Last updated