Hi Everyone,
I have written a scheduled suitescript code in which imports a csv and maps the variables at a certain time, given that the file already exists in the file cabinet and the ID is known.
However, I still have not been able to find a way to upload a file to the file cabinet automatically. I'd like to be able to push a csv file from a local drive or ( server drive \serverdatabasepdmbook1.xls) to the file cabinet when changes are made to the file or new version is available ( Maybe use MSMQ to trigger a code to push the data from my PC to file cabinet?) . Would this be possible?
I do not have that much of experience in JS or API, but very keen to learn.
This is the code I have for scheduled import script:
function scheduledimporting(type){ var csvMap = '15'; var csvFile = nlapiLoadFile("5828"); //csv file id from filecabinet //************************************************** ************************************* // originally thought of the below code to use and fetch data from a url but did not work // var urlrequest=nLapiRequestURL('https://...........',null,a); // var body=response.getBody(); //get the body of the message //************************************************** *********************************** var csvImport = nlapiCreateCSVImport();//creating a new csv import csvImport.setMapping(csvMap);//setting import map csvImport.setPrimaryFile(body.getValue());//file to be imported csvImport.setOption("jobName", "Test1111"); var csvSubmitId = nlapiSubmitCSVImport(csvImport);//submitting the CSVAny help is appreciated.Thanks,