Hey guys, I'm trying to upload a saved search to a...
# general
m
Hey guys, I'm trying to upload a saved search to a remote SFTP. I'm parsing the saved search into a CSV, I wrote a function to do it, then I create a CSV file in memory with N/File file.create and then a try to upload the file.
const executeExportIntegration = (record) => {
let searchId = record.getValue('custrecord_mvc_saved_search');
let fileName = record.getValue('custrecord_mvc_file_name');
let directory = record.getValue('custrecord_mvc_ftp_folder');
if(fileName === '') {
fileName = searchId;
}
const searchToExport = search.load({id: searchId}).run().getRange({
start: 0,
end: 1000
});
let csvData = _convertSearchToCsv(searchToExport);
let fileObj = file.create({
name: fileName + '.csv',
fileType: file.Type.PLAINTEXT,
contents: csvData
});
let connection = _connectionSFTP(record);
let objConnection = connection.list({
path: directory
});
log.debug('Current Folder', objConnection);
connection.upload({
//directory,
file: fileObj,
filename: 'af.txt',
replaceExisting: true
});
}
d
Touch base with @Josh_SatoriReporting about Tactical Connect. Save yourself a lot of headaches
j
Hi @Marcos Vinicios de Carvalho - check out www.tacticalconnect.com, out suiteapp might solve your issues. Let me know if you want to learn more.