I'm having trouble understanding the netsuite help...
# suitescript
m
I'm having trouble understanding the netsuite help docs on this- can you trigger a user event script (afterSubmit) from a scheduled workflow?
e
userevent scripts are like database triggers on records. any processing done on records will trigger UE scripts unless you specifically exclude that script type from executing UE scripts.
m
Is the key that I need to set the Trigger On to afterSubmit? It's currently set to Entry
c
When I need to figure stuff like this out I set up a script with all the events and log which one was triggered.
Copy code
/**
 * @NApiVersion 2.1
 * @NScriptType UserEventScript
 */
define(["require", "exports", "N/log"], function (require, exports, log) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.afterSubmit = exports.beforeLoad = exports.beforeSubmit = void 0;
    var beforeSubmit = function (context) {
        log.debug('beforeSubmit context', context.type);
    };
    exports.beforeSubmit = beforeSubmit;
    var beforeLoad = function (context) {
        log.debug('beforeLoad context', context.type);
    };
    exports.beforeLoad = beforeLoad;
    var afterSubmit = function (context) {
        log.debug('afterSubmit context', context.type);
    };
    exports.afterSubmit = afterSubmit;
});
Then you can test what fires as the result of your workflow firing off.
e
^ This is a great utility script to keep handy. I have a User Event and a Client script version that I keep for rapid deployment