I have a UE script that includes a Client script u...
# suitescript
j
I have a UE script that includes a Client script using
context.form.clientScriptModulePath = 'SuiteScripts/2.0/client/cl_enquiry_ss2.1.js';
I get this error:
Copy code
You do not have permission to load this module SuiteScripts/2.0/client/cl_enquiry_ss2.1.js, it has an @NModuleScope of SameAccount which restricts its availability to customization objects created in account(s)
However, cl_enquiry_ss2.1.js specifies
@NModuleScope Public
as follows:
Copy code
/**
 * cl_enquiry_ss2.1.js
 * 
 * @NApiVersion 2.1
 * @NModuleScope Public
 * 
 * last modified 2022-03-16 JB
 */
What am I missing here?
b
it has to do with the NApiVersion 2.1 you are using in cl_enquiry_ss2.1.js
it automatically defaults the module scope to same account
j
But I’ve specified
@NModuleScope Public
b
doesnt matter
j
wait, so what’s the point of
@NModuleScope Public
and how do I fix this?
b
NModuleScope is supposed to decide the access level of your module
its just irrelevent when you set NApiVersion to 2.1 on your module
j
are you saying I have to change everything back to 2.0? Cuz that seems crazypants.
We don’t share code or bundle anything. I just want to be able to use our own modules in our own scripts.
we only have one account.
b
in general the api version is irrelevant for custom modules
the entry point chooses the version
j
I’m using backticks, things break if not 2.1 ?
(in my modules)
b
either do 2.0 or you make a bug report and hope netsuite fixes it faster
preferably do both
otherwise its hope that a 2.1 user event entrypoint is enough to get the client script to also be 2.1
in which case you dont specify any script version in the custom module
j
All my SS2 scripts are explicitly 2.1
b
dont specify a version on your custom modules
j
message has been deleted
b
if you want to specify 2.1 , you have to live with the bug that it assumes same account for custom modules
j
Update on this one. It turns out, it happens when the UE runs in something other than the UI and tries to load the client script (which only really needs to be loaded in UI). So I just wrapped that in a check for
runtime.executionContext == 'USERINTERFACE'
and voila, no more weird error messages in my Script Execution Logs.