In this blog post, I will show how to import data for intercompany inventory transfers in NetSuite. The intercompany inventory transfers feature is available within NetSuite OneWorld and is meant to transfer inventory between subsidiary locations within your company. There are some settings (default status, price etc.) for intercompany transfers that can be controlled in settings->Accounting preferences. However, currently, NetSuite doesn’t support CSV import for this transaction type – and as a NetSuite implementation partner, this is a common requirement – therefore, I’ve developed an alternate method to import this data. One of the simplest methods to do this is to create a CUSTOM record and build intercompany transactions, which I will detail below.
To start, let us build a CUSTOM record as shown further down. The custom record is meant to stage the data. There are no validations in place, hence the CSV file should hold proper and meaningful values.
The next step is to create a USER EVENT Script and deploy it on the custom record type that we created in the previous step.
Create and deploy user event script something like below. As you can see the ‘Applies To’ field is what tells the script to deploy to the custom record we just created above.
Here is an example of the deployment script:
// Build saved search to fetch only those rows from customRecord that are set with ‘Ready to process’. // Note that the CSV import will set the status to ‘Ready to process’. //Loop through each unique Batch_ID and store the values to variable.
//Var from_subsidiary = ‘2’; //internal ID
Var to_subisidiary = ‘3’; //internal ID
Var from_location = ‘10’; //internal ID
Var to_location = ‘20’; //internal ID
Var item_name =’100’; //internal ID
Var item_qty = 20;
Var item_price = 120;
Note: The current example is one item only but we can build for multiple items using loop.
The script to create and fetching values from saved search is not shown above. However, once we have the values, we can create the intercompany transfer record as shown below.
NLRecordObject interCoTransfer = nlapiCreateRecord(‘intercompanytransferorder’, true);
interCoTransfer.setFieldValue(‘orderstatus’, ‘F’); //to pending fulfilment
interCoTransfer.setFieldValue(‘subsidiary’, from_subsidiary); interCoTransfer.setFieldValue(‘tosubsidiary’, to_subisidiary);
// If there are multiple items within same transfer order, then loop here.
interCoTransfer.setCurrentLineItemValue(‘item’, ‘Item.item’, item_name);
interCoTransfer.setCurrentLineItemValue(‘item’, ‘Item.rate’, item_price);
String key = nlapiSubmitRecord(interCoTransfer);
Store the internal ID of the created record onto the custom record. Also, wrap the above code is try…catch block and trap any errors and update on the custom record. The code sample above is to just show the intercompany record creation and doesn’t cover the entire script such as fetching records from the custom record, updating status onto custom record, error handling etc. Also, once the intercompany transfer record is created it also needs to be approved/fulfilled/received depending on the configuration of the settings.
With the approach detailed above, it is possible to import transfer orders into NetSuite. There are other ways such as building a Suitelet application and user event script or building a RESTlet.
Hopefully, you found this blog to be useful and as always please don’t hesitate to reach out to us with any NetSuite questions or comments!