1

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 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

You're missing the usereventscript/beforeloadfunction element:

<beforeloadfunction>beforeLoad</beforeloadfunction>

6 Comments

Thank you for your reply, however I am still getting the same error. I added the mentioned element in the User Event Script XML and it did not work. I appreciate the help though.
Sorry to hear. What I usually do in similar situations is to create a script in the UI, download the XML from the UI and them compare to the one I am trying to upload. Perhaps that helps.
How would one download the XML from the script?
And finally ... that did not work either. Again, I appreciate your help.
Perhaps another idea is to add the other two entry points, as well. I can see that the XMLs from the UI contain the elements for all entry points. <aftersubmitfunction></aftersubmitfunction> <beforeloadfunction>beforeLoad</beforeloadfunction> <beforesubmitfunction></beforesubmitfunction>
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.