Search code examples
javascriptworkflownetsuitesuitescript

Trigger Workflow from Script Netsuite


Okay, I have decided to strip this one back to the bare bones based on the Netsuite documentation and go from there.

With the below in place I receive the following error still -

"Syntax error: missing : after property id"

Any help is greatly appreciated.

/**
 * @NApiVersion 2.0
 * @NScriptType UserEventScript
 */

require(['N/task'], 
function(task) {
var workflowTask = task.create({taskType: task.TaskType.WORKFLOW_TRIGGER});
workflowTask.recordType = 'customer';
workflowTask.recordId = 107;
workflowTask.workflowId = 3;
var taskId = workflowTask.submit();

return {
workflowTask};
});

Solution

  • Looks like you are missing the entry points for the UserEvent script. I don't see something like

    exports.beforeSubmit = beforeSubmit;
    exports.beforeLoad = beforeLoad ;
    exports.afterSubmit = afterSubmit ;
    
    return exports;