Really strange issue with client script: I have a ...
# suitescript
d
Really strange issue with client script: I have a very simple client script that only do 'alert('test') on pageInit of purchase order, the issue is the client script not even triggered, (edit or create), I checked the script on the same record and there is only 3 client scripts there so the limitation of 10 is not the issue the script is deployed and in release state, script is also have all contexts and roles/audinace what could be the problem here?
n
Is there anything in the dev console logs that show an error?
d
No logs, no errors
n
And is your client script returning the PageInit function at the bottom? That one gets me a lot. Also make sure your script file in NS ends with the .js
d
also if i do log.debug its not work
Copy code
/**
 * @NApiVersion 2.1
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */
define([],

    function () {
        function pageInit(scriptContext) {
          alert('test')
        }


        return {
            pageInit: pageInit,
        }
    });
thats the script
n
I deployed it in one of my accounts too and it didn't work either. So i guess at least its consistent. Ill play around with it
d
Very strange...
n
Ohhh wait. PageInit only works in edit mode not view. I was looking in View. When i click edit it works
d
on my env edit/create doesnt triggered the script
no idea why
n
That makes me think its something with the deployment record. • Script file ends in .js • In testing, or if Released make sure audience is set • Execution context is UI • Deployed checkbox is checked
r
can you log something in client script and see if that log is coming up, I doubt your client script is properly deployed. Code looks fine.
d
I have checked all of the above: • script file is ends with js (aldo this script is uploaded with SDF) • audince and context sets • script is deployed
I did log.debug and console.log and still nothing
n
Maybe go to the scripted records page for that record, and move you script to the top of the execution order. That will tell us if there is maybe another script that is stopping it from running
d
its already at the top
n
lol damn. Sorry David I think im out of ideas
d
Lol I think is a bug inside netsuite or something wrong with that env...
n
Could be. I got several emails this weekend about sandbox upgrades and maintenance.
e
Try this...reference the client script using form.clientScriptModulePath in your UE script. I've seen weird errors with client scripts lately where even referencing document is triggering errors especially when creating the script record.
d
there is no UE script, its only client script that supposed to do validation on the record, but its still not triggered.
I found the problem ! - its realy strange but when i change the name of the folder where the scripts inside its worked. the name was with '/' when its didnt work, when i remove the '/' its works. dont know why but thats it
🥳 1