Can anyone tell me why I'd get this error on my cl...
# suitescript
b
Can anyone tell me why I'd get this error on my client script in NetSuite 2.1?
ReferenceError onReceiveButtonClick is not defined
I'm trying to create a button to do stuff on an item receipt (i don't think it will work, but testing to be sure) and I can't even call the function defined in the client script without getting this error. The function is defined in the CS and just has an alert in it for now for testing and the button is defined on the script record in NS with the function being the one specified in the CS. It's in return in the CS as well. I've deleted the deployment and recreated as well, no luck.
Copy code
define(['N/currentRecord', 'N/error', 'N/log'],
/**
 * @param{currentRecord} currentRecord
 * @param{error} error
 * @param{log} log
 */
function(currentRecord, error, log) {
    
    /**
     * Function to be executed after page is initialized.
     *
     * @param {Object} scriptContext
     * @param {Record} scriptContext.currentRecord - Current form record
     * @param {string} scriptContext.mode - The mode in which the record is being accessed (create, copy, or edit)
     *
     * @since 2015.2
     */
    function pageInit(scriptContext) {
        // TODO
    }

    function onReceiveButtonClick() {
        alert("I worked!");
    }

    return {
        onReceiveButtonClick: onReceiveButtonClick,
        pageInit: pageInit        
    };
});
n
What does your UE script look like?
Have you deployed the CS or adding it via UE script?
e
Looks correct to me; maybe just make sure that the
onReceiveButtonClick
is in the
return
statement in the file that's actually deployed in NetSuite, and then clear your browser cache as Client Script content is quite often cached.
b
Thanks, this is a client script only. I actually was following Eric's article from his stoic software site to create a client script. It only needs to be functioning in edit/create context. It is deployed.
e
I had to read my own article to refresh myself ...
b
it should be super simple as all it's doing now is supposed to throw an alert.
🙂
it's been a while...
clearing browser cache didn't make a difference
😞 1
b
client script looks fine
so you need to share the user event
e
Sounds like there's not a User Event; the button is defined on the Client Script record
the button is defined on the script record in NS with the function being the one specified in the CS
b
thats extra weird, you dont deploy a script for the client script attached to a form
there shouldnt be a deployment to create or delete
e
guessing it's on the Client Script record as below
b
meh, dont know that button that well
last time i tried it was suitescript 2.0, so my new advice is now to try suitescript 2.0
b
thanks