durga
durga

Reputation: 115

"define" is not defined when executing suite script 2.0 user event

I'm trying to execute the suite script2.0 user event

/**
 *@NApiVersion 2.0
 *@NScriptType UserEventScript
 */
define(["N/record"], function (r) {
    function onAfterSubmit(context) {
}})

but while uploading the js file in net enter image description heresuite It's not allowing to upload the 2.0 js file

i'm getting define no defined error..

thanks in Advance!

Upvotes: 1

Views: 1744

Answers (2)

Bryce Carlson
Bryce Carlson

Reputation: 11

This is an annoying thing that I have run into with 2.0, but it is because your name on the Script File needs to end in ".js" This should fix it

Upvotes: 1

Sachin Savale
Sachin Savale

Reputation: 139

Your code isn't being recognized as SS2. You need a space between the * and the @N... in the JSDoc

/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 * @NModuleScope SameAccount
 */
define(['N/record'],
    function(r){


        function onAfterSubmit(context){

            log.debug('After Submit Triggered');

        }

    return {
    afterSubmit: onAfterSubmit
};

});

Upvotes: 4

Related Questions