I made a copy of a PO and expected this code to lo...
# suitescript
m
I made a copy of a PO and expected this code to log the line, but it didn't:
Copy code
const beforeLoad = (context) => {
    if(context.Type === context.UserEventType.COPY) {
        log.debug({title: "User Event", details: context.Type});
    }
}
c
Does context.Type log anything?
w
I would expect the copy state to only fire before/after submit
a
@Webber SuiteAnswers 42312 has an example that has a beforeload on a copy event.
SuiteAnswer 90159 states it more explicitly.
n
isn't it context.type all lower case? @mg2017
Copy code
if (context.type === context.UserEventType.DELETE) {
    return
}
Is what I see in all my code... and in the JSDOC
Copy code
* @param {string} context.type - Trigger type; use values from the context.UserEventType enum
c
I was trying to lead him to that one
m
I just ran the code in beforeLoad, beforeSubmit & afterSubmit. It executed in the BeforeLoad and the issue was the lowercase! context.type instead of context.Type.
Thanks!
👍 1