Skip to content

Instantly share code, notes, and snippets.

@thuutien
Created October 17, 2023 18:39
Show Gist options
  • Save thuutien/c9ea7033cb283b22bc49a4249b12b4e1 to your computer and use it in GitHub Desktop.
Save thuutien/c9ea7033cb283b22bc49a4249b12b4e1 to your computer and use it in GitHub Desktop.
SuiteScript for exporting search to file cabinet
/**
*@NApiVersion 2.x
*@NScriptType ScheduledScript
*/
define(['N/task','N/log'],
function(task)
{
function execute(context)
{
//create search task
var myTask = task.create({
taskType: task.TaskType.SEARCH
});
myTask.savedSearchId = 2497;
myTask.fileId = "undefined"; //need to create a file and get ID
// or use this: myTask.filePath = 'ExportFolder/export.csv';
var myTaskId = myTask.submit();
log.audit({title:"Search Export Task submitted.",
details:"Exported seach 2497 in csv file with InternalID:<undefined>"});
}
return {execute: execute
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment