1
votes

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?

2

2 Answers

1
votes

Well, the answer was simpler than I expected. Mind you, I come from a Visual Studio c# background so I am seeing this from that perspective.

The later versions of Eclipse (after Kepler) stopped supporting the SuiteCloud Development Framework plugin. Either that, or you need to add more to the installed version of Eclipse to get it to work correctly and I have not found any documentation to help with that at all.

We scrubbed our Eclipse installs and went back to Eclipse Kepler (4.3.2) and everything worked as it should.

It is my belief that this is a disservice to developers as we should be able to access the most current versions of libraries and plugins available through the IDE's, but that is just my opinion. In the end, we have working models and can deploy to all of our environments from our dev machines so we can get things done now.

Thank you for your time in assisting with this question. I appreciate it.

0
votes

You're missing the usereventscript/beforeloadfunction element:

<beforeloadfunction>beforeLoad</beforeloadfunction>