简体   繁体   中英

Netsuite suitescript for converting saved search to csv

I am trying to export simple script to csv with code below in suitescript 2.0,

require(['N/task'],
function(task) {
    
 var SEARCH_ID = 1487;



       var searchTask = task.create({

           taskType: task.TaskType.SEARCH

     });

       searchTask.savedSearchId = SEARCH_ID;

       var path = 'Test/export.csv';
 
       searchTask.filepath = path;
       
       var searchTaskId = searchTask.submit();
 
       var a = 0;});

However, it gives the following error,

SSS_MISSING_REQD_ARGUMENT 10/5/2021 10:15:40.917 {"type":"error.SuiteScriptError","name":"SSS_MISSING_REQD_ARGUMENT","message":"task.submit: Missing a required argument: fileId / filePath","stack":["createError(N/error.js)","(adhoc−1debugger.user:25)","(adhoc−1debugger.user:3)"],"cause":{"name":"SSS_MISSING_REQD_ARGUMENT","message":"task.submit: Missing a required argument: fileId / filePath"},"id":"","notifyOff":false,"userFacing":true}

Please guide me how to troubleshoot it. I have never worked with script before so any suggestions are welcome.

Thanks!

The filePath needs to be a full path from the top of your File Cab.net hierarchy. All the folders referenced must exist.

Additionally the recommended way to create the search task is as a single step:

var searchTask = task.create({
    taskType: task.TaskType.SEARCH,
    savedSearchId: searchId,
    filePath: filePath
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM