https://netsuiteprofessionals.com logo
j

jen

04/04/2022, 4:44 PM
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

battk

04/04/2022, 5:19 PM
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

jen

04/04/2022, 6:13 PM
But I’ve specified
@NModuleScope Public
b

battk

04/04/2022, 6:28 PM
doesnt matter
j

jen

04/04/2022, 7:42 PM
wait, so what’s the point of
@NModuleScope Public
and how do I fix this?
b

battk

04/04/2022, 7:56 PM
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

jen

04/04/2022, 8:06 PM
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

battk

04/04/2022, 8:07 PM
in general the api version is irrelevant for custom modules
the entry point chooses the version
j

jen

04/04/2022, 8:08 PM
I’m using backticks, things break if not 2.1 ?
(in my modules)
b

battk

04/04/2022, 8:12 PM
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

jen

04/04/2022, 8:52 PM
All my SS2 scripts are explicitly 2.1
b

battk

04/04/2022, 9:06 PM
dont specify a version on your custom modules
j

jen

04/04/2022, 10:19 PM
message has been deleted
b

battk

04/04/2022, 10:36 PM
if you want to specify 2.1 , you have to live with the bug that it assumes same account for custom modules
j

jen

04/06/2022, 4:13 PM
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.