MG2016
MG2016

Reputation: 319

NetSuite - Multiple Subsidiaris for Vendor Import Issue

looks like there is a limitation when we mass import Vendors into NetSuite in that we cannot specify multiple subsidiaries in our mappings.

Since I need to import few 100 vendors I don't really wish to edit each vendor record where a vendor requires more than on subsidiary.

Are we able to do anything clever in code for this or has anyone got a solution for this limitation?

Thanks

Upvotes: 1

Views: 2093

Answers (2)

Eidolon108
Eidolon108

Reputation: 403

As an alternative to Rusty Shackles, there's an undocumented sublist that is accessible on vendor records for the subsidiaries. This sublist has the name submachine. For whatever reason, it must be accessed using record.selectLineItem,record.setCurrentLineItemValue, and record.commitLineItem as opposed to the record.setLineItemValue API functions.

For example, I have a mass update script that was used to replace a subsidiary from every vendor on the mass update search. Here's the code sample

function massUpdate(recType, recId) {
    var context = nlapiGetContext();
    var subToRemove = context.getSetting('SCRIPT', 'custscript_subsidiary_to_remove');
    var subToReplace = context.getSetting('SCRIPT', 'custscript_replacement_sub');
    var record = nlapiLoadRecord('vendor', recId);
    var lineCount = record.getLineItemCount('submachine');
    nlapiLogExecution('DEBUG', 'lineCount = ' + lineCount)
    if (lineCount > 0){
        for (var i = 1; i <= lineCount; i++){
            record.selectLineItem('submachine', i);
            var sub = record.getCurrentLineItemValue('submachine', 'subsidiary')
            nlapiLogExecution('DEBUG', i, sub);
            if (sub == subToRemove){
                record.setCurrentLineItemValue('submachine', 'subsidiary', subToReplace);
                record.commitLineItem('submachine');
                break;
            }
        }
    }
    nlapiSubmitRecord(record);
}

So that opens up the possibility of writing your own scheduled script that processes a file and updates the subsidiary list, for whatever reason a CSV upload isn't useable.

Upvotes: 2

Rusty Shackles
Rusty Shackles

Reputation: 2840

You tried doing two imports.

The first one to create the Vendor record in Netsuite, just assign one if the subsidiaries. Then do edit your CSV file to something like this:

Vendor A, Sub B
Vendor A, Sub C

Then do an updated CSV Import.

Upvotes: 2

Related Questions