In this NetSuite tutorial, I am going to demonstrate how we can programatically set multiple subsidiaries on a Vendor sublist when performing a data import.  In our example, we are using the‘Vendor’ entity, which can have one or more subsidiaries associated with it – including a primary subsidiary, as shown in the below snapshot.

vendor subsidiary sublist NetSuite

Now, everything would be fine if we were enter Vendors though the UI – but what if we have data from other systems that we need to import?

The CSV import tool does not allow you to map subsidiaries, as there is no provision for the Vendor Subsidiary relationship in the field mapping, as show in the below snapshot.

Field Mapping Import NetSuite

After doing some proof of concept work, we found that while we couldn’t map multiple subsidiaries to the out of the box “Subsidiary” field through the import tool, would could use it to accomplish the same task using code!

Since we wanted to import data using a CSV file – to accomplish this, we first needed to create a custom body field on the vendor record where we are going to store a string of all the subsidiaries that we’re looking to associate – in this example, I’ve named this field ‘vendor-subsidiaries.’ Our next step was to create a column in the CSV file to list all subsidiaries associated to the vendor.

Below is a small example of the CSV file, where you can see the Vendor, XYZPrint1, has 3 subsidiaries – Subsidiary 10, Subsidiary 20 and Subsidiary 30.

Vendor IDVendor NameVendor – Subsidiaries
XYZPrint1XYZ Printers10#20#30

Note: The first value will always be handled as the primary subsidiary – and in this example it is 10. The value in the subsidiaries column represents the Internal Id of the subsidiary in NetSuite – and each subsidiary is separated by a delimiter character of ‘#’.

Finally, we wrote a user event script bound to the Vendor record as shown below – within the script, we used our custom string field of the delimited list of subsidiaries field from the vendor record to insert the actual subsidiaries.

Vendor Sublist Subsidiary Code

As you can see in the above script, we read the values from ‘vendor-subsidiaries’ and then loop through the list and update the subsidiaries one by one. After each update, NetSuite adds the subsidiary to subsidiary sublist.  Finally, line number 20 in our code sets the primary subsidiary.


With the simple code above, we were able to control the subsidiary sublist within the Vendor record, despite the fact that NetSuite does not expose this sublist in the record browser.

Thanks for reading this post on how to use a scripts to update hidden sublists in NetSuite. Please feel free to contact the MIBAR team if you’re looking for NetSuite support – we’re here to help you supercharge your NetSuite implementation!

Additional NetSuite Resources

NetSuite: A Better Duplicate Purchase Order Warning

Creating Filtered Dropdown Lists in a Custom Field in NetSuite

NetSuite Saved Search Magic with Dynamic Drill Through

6 Tips for NetSuite Advanced PDF Templates

Wait! Before You GoWould you like to talk to a business software expert to answer your questions?

When you schedule a free consultation with MIBAR, you will experience a one-on-one conversation with a business technology expert who is passionate about understanding your unique needs or issues. Schedule a free consultation today at the link below or give us a call at (212) 869-9300.

Learn More
NetSuite Offer: Save $15,000 With Our Limited-Time Discount

If you’ve been evaluating NetSuite, there is no better time to make the switch. With a NetSuite subscription through MIBAR by December 31, 2020, we will offer you 75 hours of professional consulting services for FREE.

Not only can a new ERP system like NetSuite help you reduce operating costs by automating manual processes, but this limited time offer can also help save you a substantial amount of money upfront.