ANS-1890 · SUITESCRIPT DEVELOPMENT

How to Trigger a CSV Import for Item Demand Planning Fields per Location?

Programmatically update location-specific demand planning data on NetSuite item records using CSV imports.

Short answer

To update demand planning fields on item records per location, initiate a CSV import targeting the item's Location sublist. This sublist facilitates location-specific data updates. A script can be used to programmatically trigger this import, potentially generating the import file from a Suitelet and saving it to the file cabinet.

Scenario

Organizations often need to update demand planning fields for specific items across multiple inventory locations within NetSuite. Manually updating these fields for each location on every item can be time-consuming and prone to error. A programmatic solution is required to efficiently manage these location-specific item attributes.

Solution

The most effective method for updating demand planning fields on the item master's location matrix is by performing a CSV import of the item, specifically leveraging its 'Location sublist'. This sublist is primarily available through CSV imports.To initiate a CSV import programmatically, a script can be utilized. The content for the import file may need to be generated by a Suitelet and subsequently saved to the NetSuite file cabinet.Below is an example of how a CSV import could be triggered using SuiteScript 1.0 functions. For current implementations, it is recommended to use the equivalent SuiteScript 2.x APIs.

function triggerCsvImport(fileContent, mappingId){    var importJob = nlapiCreateCSVImport();    importJob.setMapping(mappingId);    importJob.setPrimaryFile(fileContent);    importJob.setOption("jobName", "cardProcessor_" + getDateTimeString(new Date()));    var jobId = nlapiSubmitCSVImport(importJob); // 100 units    nlapiLogExecution('audit', 'Triggered Job Id', jobId);}

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant