https://netsuiteprofessionals.com logo
#suitescript
Title
# suitescript
n

NS Expert

04/11/2022, 6:26 PM
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

battk

04/11/2022, 6:33 PM
ScheduledScriptTask.submit lists the requirements needed
n

NS Expert

04/11/2022, 6:40 PM
Thank you!
t

tech_ph2019

04/11/2022, 7:06 PM
@NS Expert add the Suitescript Scheduling permission to your role
n

NS Expert

04/11/2022, 7:13 PM
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.
3 Views