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.
Create csv file
Hi, I'm trying to create a csv file with the below code that I found at this website (http://emergetech.com/netsuite-customization/netsuite-customization-creating-a-csv-from-a-saved-search-part2) , but I'm getting an error that the nlapiCreateFile is not defined.
function createFile(){ try{ var searchResults = nlapiSearchRecord(null, 'customsearchnl_labour_cost'); var csvBody = '' if (searchResults == null || searchResults.length < 1) return; for (var i=0; i<searchResults.length; i++){ csvBody += searchResults[i].getValue('date') + ','; csvBody += searchResults[i].getValue('account') + ','; csvBody += searchResults[i].getValue('amount') + 'n'; } var file = nlapiCreateFile('nl_labour_cost.csv', 'CSV', csvBody); file.setFolder('96'); nlapiSubmitFile(file); }catch(e){ nlapiLogExecution('Error', 'createFile', 'Error while creating file – ' + e.message); } } 0