I am using N/task module to call scheduled script ...
# suitescript
n
I am using N/task module to call scheduled script inside UE script.
Copy code
var scriptTask = task.create({
  taskType: task.TaskType.SCHEDULED_SCRIPT,
  scriptId: 'customscript_xxx',
  deploymentId: 'customdeploy_xxx',
  params: {...}
});
var scriptTaskId = scriptTask.submit();
And it shows this error message:
Copy code
{
  "type": "error.SuiteScriptError",
  "name": "INSUFFICIENT_PERMISSION",
  "message": "You do not have permission to perform this operation.",
  "stack": [
    "submit(N/task)",
    "afterSubmit(/SuiteScripts/UE_Soft_Credit.js:75)"
  ],
  "cause": {
    "type": "internal error",
    "code": "INSUFFICIENT_PERMISSION",
    "details": "You do not have permission to perform this operation.",
    "userEvent": "aftersubmit",
    "stackTrace": [
      "submit(N/task)",
      "afterSubmit(/SuiteScripts/UE_Soft_Credit.js:75)"
    ],
    "notifyOff": false
  },
  "id": "",
  "notifyOff": false,
  "userFacing": false
}
What is the reason? Does it need administrator permission to submit task inside SuiteScript?
b
ScheduledScriptTask.submit lists the requirements needed
n
Thank you!
t
@NS Expert add the Suitescript Scheduling permission to your role
n
The role is supposed to work for API. "Allows use of an API (for example, ScheduledScriptTask.submit()) to execute an on demand scheduled script or on demand map/reduce script." But I don't use API and call it in UE script.