Have anyone use dynamic import within a SuiteAPP? ...
# suitescript
l
Have anyone use dynamic import within a SuiteAPP? it keep saying `
Copy code
NO_PERMISSION_TO_MODULESCOPE_SAMEACCOUNT_MODULE"
but all my script is using
Copy code
@NModuleScope Public
I test whole day but still not working….
p
Are you pulling a module in your define statement that doesn't have this at the module itself?
Copy code
/**
 * myModule.js
 * @NApiVersion 2.x
 * @NModuleScope Public
 */
l
Should I have this within my custom module also!?
OMG I’ll test this right away
p
I tend to use SameAccount to be honest and have nothing in my module as far as comments go, but just looking at the SuiteAnswers for custom modules there was something about module scope, so worth a shot for compatibility
l
Appreciate for the idea, will test it now
p
You're welcome. SuiteAnswer that may assist are 67639 and 49326
l
Awwww, still the same error
I hate this 😞
p
Looking at SuiteAnwers, that is the solution, though: 69474 Are they both 2.x?
l
both 2.1
p
Are they both in the same NetSuite account? Maybe that's a daft question, but worth checking
l
Yes, I create them in same NS account and create SuiteApp install into our QA environmnet
environment*
p
Then you shouldn't need public ... Try change both to SameAccount
l
just try SameAccount still the same.
I’m thinking maybe NS doesn’t allow us using dynamic import
p
How are you importing it? Is it in the define statement, or a require ... or something else?
l
Copy code
const bundleId = runtime.getCurrentScript().bundleIds;
        const libPath = `/.bundle/${bundleId}/Utils/${type}/${action}.js`;
I put this into a utils, base on the type and action, will pull different library
it works in suitescripts
p
I've never tried to use a module like that
When you log it out, does it have the correct path?
l
Yes, the path is correct, if is not correct will show MODULE NOT FOUND error meessage
p
I see. Sorry buddy, I'm out of ideas for this one.
l
Appreciate so the idea anyway! Thank you!
p
You're welcome - good luck! 🙂
Not really a solution, but its a similar error message
p
@battk The thread does offer a solution, though, update to 2.x. Linc can't change to 2.0 because he has es6 stuff there, but it looks like it's worth a shot to me
What I mean is, change to 2.x and set the preference for 'treat 2.x scripts as ...' to 2.1
a
@Paul L I could be wrong, but I recall Grand Master Netsuite Jedi @erictgrubaugh saying using 2.x wasn't preferred and could lead to bugs
e
I advise people to choose a specific version, yes. It's especially important if you use 2.1 syntax as you cannot always control the value of the General Preference which determines whether 2.x means 2.0 or 2.1
l
I give it up for the dynamic import, I end up with switch case….
But thank for everyone’s insight
👍 1