Good afternoon.
I am REALLY struggling with this and apparently it should be extremely simple to figure out. I am using Eclipse Neon.3 Release 4.6.3 to build, compile, and deploy SuiteScript 2.0 to our Sandbox environment. I have successfully managed a 1.0 deployment with working scripts, but as we are moving to 2.0, this is now an imperative thing to fix.
The error is: SuiteScript 2.0 entry point scripts must implement one script type function.
Here is the script:
/**
* @NApiVersion 2.0
* @NScriptType UserEventScript
*/
define(['N/record'],
function (record) {
function doThis(context) {
log.debug({'details': 'IN THE FUNCTION!'});
}
return {
beforeLoad: doThis
};
});
And here is the User Event XML (since the error is pointing to this as the file:
<usereventscript scriptid="customscript_userevent">
<aftersubmitfunction/>
<beforeloadfunction>doThis</beforeloadfunction>
<beforesubmitfunction/>
<description></description>
<isinactive></isinactive>
<name>SDF Tutorial User Event</name>
<notifyowner>T</notifyowner>
<scriptfile>[/SuiteScripts/UserEventScript_2.js]</scriptfile>
<scriptdeployments>
<scriptdeployment scriptid="customdeploy_ue_tut">
<isdeployed>T</isdeployed>
<loglevel>DEBUG</loglevel>
<recordtype>[customrecord_tutorial]</recordtype>
<status>TESTING</status>
</scriptdeployment>
</scriptdeployments>
Apparently, I am missing the correct Script Type function but that's what I thought beforeLoad actually was doing. What am I missing here?