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.
nlapirequestURL - FTP access to Filecabinet
Hi Everyone,
I have been trying to access a file through a website and download it to Netsuite's Filecabinet, and then import and map variables in Netsuite using Scheduled scripting. But I have been getting an error. Here is my code, any help is appreciated?
Is this possible?
Can it be run in scheduled script?
function scheduledimporting(type){ var urlrequest=nlapiRequestURL('http://users17.jabry.com/testepdm/Test.csv',null,null); //Reqeust file from FTP servers //var body=readResponse.getBody(); //get the body of the message var responseJson=JSON.parse(response.getBody()); //Parse the response var error = responseJson['error']; //Error Handling if (error) //start IF { var code = error.code; var message = error.message; nlapiLogExecution('DEBUG','failed: code='+code+'; message='+message); nlapiCreateError(code, message, false); } //End iF var filecontentx64=responseJson["filecontentbase64"]; //Decode var textcontent=decode_base64(filecontentx64); //create new folder var myfolder = nlapiCreateRecord('folder'); myfolder.setFieldValue('name','CSV-Folder'); var myfolderid = nlapiSubmitRecord(myfolder); //returns out folder id //File to filecabinet var csvfilename="URLREQUESTTTT.csv"; var csvfile=nlapiCreateFile(csvfilename,"CSV",textcontent); csvfile.setFolder(myfolderid); var mytxtfileId = nlapiSubmitFile(csvfile); //returns out file id //Import Process var csvMap = '15'; //saved CSV import id var csvImport = nlapiCreateCSVImport();//creating a new
Tagged:
0