This topic contains 3 replies, has 0 voices, and was last updated by Olivier Gagnon NC 8 years ago.

  • Author
    Posts
  • #1562

    pcutler

    I 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.

  • #1563

    david.smith

    I 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.

  • #1564

    pcutler

    Thanks 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.

  • #1565

    Olivier Gagnon NC

    Yeah 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.

You must be logged in to reply to this topic.