Search code examples
netsuitesuitescriptcsv-import

Scheduled CSV Import's Deployement Error In Netsuite


I tried to update the employees record in an Netsuite system using the Scheduled CSV Import. while deploying the Scheduled Script, I put the status has "Testing" and click "Save & Execute" Button for testing purpose.

And then I checked the Execution Log in the Log it shows the following error message:

" com.netledger.app.common.scripting.version1.nlobjCSVImportImplV1"

Scheduled Script Code:

function scheduled(type) {

    var fileId = nlapiGetContext().getSetting('SCRIPT', 'custscript_sfg_customer_rec_cus_param');
    nlapiLogExecution('DEBUG','fileId:',fileId);
    var import1 = nlapiCreateCSVImport();
    nlapiLogExecution('DEBUG','import1:',import1);
    var mapping = import1.setMapping('CUSTIMPORT_emp_rec_imp');
            //  Internal id for mapping
    nlapiLogExecution('DEBUG','mapping:',mapping);
    var setPrimary = import1.setPrimaryFile(nlapiLoadFile(fileId));
            // id is Internal id for Employee file
    nlapiLogExecution('DEBUG','setPrimary:',setPrimary);
    var submitImport = nlapiSubmitCSVImport(import1);
            // Importing is Done
    nlapiLogExecution('DEBUG','submitImport:',submitImport);
}

Help me to find the solution for creating the scheduled CSV Import.

Thanks in Advance.


Solution

  • There are a couple of possible issues with your code:

    1. When I have done this I've used all lower case for the import id. e.g. use 'customimport_emp_rec_imp' not 'CUSTIMPORT_emp_rec_imp'
    2. Make sure the saved csv import definition is public
    3. Set a job name with import1.setOption("jobName", "Employee Import");