Created
October 17, 2023 18:39
-
-
Save thuutien/c9ea7033cb283b22bc49a4249b12b4e1 to your computer and use it in GitHub Desktop.
SuiteScript for exporting search to file cabinet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*@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