Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
CSV Import - Unexpected Error
Hi,
This is my first try at running a CSV Import from a file attached to a case. I'm having no trouble pulling the file with a saved search, but I keep getting:
"UNEXPECTED ERROR during CSV Import process" on nlapiSubmitCSVImport()
Here is what I'm working with:
function importCsvFile(){ var messageSearch = nlapiSearchRecord("message",null, //start by setting up criteria [ ["subject","contains","ITEMIMPORT"], "AND", ["messagedate","within","today"] ], //and then the results page [ new nlobjSearchColumn("internalid","attachments",null) ] ); for (var i=0;i<=messageSearch.length-1; i++){ nlapiLogExecution('debug','test',i); var fileId = messageSearch[i].getValue('internalid','attachments',null); nlapiLogExecution('debug','fileId = ',fileId); var import = nlapiCreateCSVImport(); import.setPrimaryFile(nlapiLoadFile(fileId)); import.setMapping('CUSTIMPORTImportItemMapping'); import.setOption('jobName','itemImport'); var importId = nlapiSubmitCSVImport(import); nlapiLogExecution('debug','importId = ',importId); } } 0