This topic contains 3 replies, has 0 voices, and was last updated by Olivier Gagnon NC 8 years ago.
-
AuthorPosts
-
November 10, 2016 at 12:43 pm #1562
pcutlerI am attempting to enable scriptable cart in an account that has a global suitescript 2.0 client script and running into an issue. The N/ui module is not defined when the script runs in the context of the webstore.
I have come up with the following work-arounds:
1. Switch to form level client script and use a different custom form for orders originating from the web store – bad for maintenance effort
2. Reference all modules with define([‘N’], function(nModule) { /* code goes here */ }); – bad for performance
3. Undeploy the script from certain roles – potentially the best option
Any other ideas?
This is a cached copy. Click here to see the original post. -
November 10, 2016 at 1:10 pm #1563
david.smithI believe the N/ui module(s) is for use in the NetSuite UI. I’m not sure what you’re global client script is trying to do but you could take it out of the define and try putting it in as a require on the condition that the script is truly running in the NetSuite interface.
-
November 10, 2016 at 1:53 pm #1564
pcutlerThanks for the suggestion, I ended up changing the deployment from All Roles to All Employees and now my script runs for all users in the UI but not in the web store, preventing errors. The route you suggested was good as well, but that would have required changes to the script and QA.
-
November 11, 2016 at 5:05 am #1565
Olivier Gagnon NCYeah there is a defect that SS2.0 trigger for scriptable checkout if deployed to all roles. Such scripts immediately crash your website because they aren’t supposed to run and NS is unable to load them properly. The workaround is exactly what you did, or to put an if(context=userinterface) kind of clause inside the script.
-
AuthorPosts
You must be logged in to reply to this topic.
