For NetSuite Map/Reduce script - Why is map stage failing when being called from Restlet?

时间:2018-03-22 23:54:01

标签: deployment mapreduce netsuite restlet suitescript

In NetSuite, have a Restlet script that calls a deployed map/reduce script but the map stage shows as Failed when looking at details of status page (the getInputData stage does run and shows as Complete).

However, if I do a "Save and Execute" from the deployment of the map/reduce script, it works fine (Map stage does run).

Note that:

  • There is no error on execution log of either the restlet or the map/reduce scripts.
  • Have 'N/task' in define section of restlet as well as task in function parameters.
  • The map/reduce script has the Map checkbox checked. The map/reduce script deployment is not scheduled and has default values for other fields.
  • Using NetSuite help "See the quick brown fox jump" sample map/reduce script
  • Using Sandbox account
  • Using a custom role to post to restlet

Below is call to create.task code snippet from my Restlet. Don't know what is wrong, any help is appreciated.

var mrTask = task.create({
  taskType: task.TaskType.MAP_REDUCE,
  scriptId: 'customscript_test',
  deploymentId: 'customdeploy_test'
});
var mrTaskId = mrTask.submit();
var taskStatus = task.checkStatus(mrTaskId);
log.debug('taskStatus', taskStatus);

2 个答案:

答案 0 :(得分:1)

MapReduceScriptTask.submit()的帮助没有提到这个,但ScheduledScriptTask.submit()的帮助确实如此:

  

只有管理员才能运行预定脚本。如果用户事件脚本调用ScheduledScriptTask.submit(),则必须使用管理员权限部署用户事件脚本。

我测试了使用管理员角色凭据发布到我的restlet,它可以正常工作,而不是使用我的其他自定义角色。也许就像ScheduledScriptTask一样,MapReduceScriptTask只能由管理员角色调用?我的自定义角色确实具有SuiteScript - View和SuiteScript Scheduling - 完全权限。以为这样可以解决问题,但显然不是。

有人对此有任何进一步的了解吗?

答案 1 :(得分:0)

您还需要Documents and Files -View权限以及SuiteScript-View和SuiteScript计划-完整权限才能访问Map / Reduce脚本。