This topic contains 2 replies, has 0 voices, and was last updated by chanarbon 8 years, 2 months ago.

  • Author
    Posts
  • #1802

    jpayne

    I got the following errors when trying to include the ‘N/config’ module in a form-level client script for external payments in the Customer Center.

    I want to access a customer-level script parameter. My parameter shows up on the dashboard under Setup > Company > General Preferences > Custom Preferences and I want to be able to set the value for parameter in this one spot. The value is needed by a script that runs on the ‘Make a Payment’ page in the Customer Center, but I can’t figure out how to access it in code given this error when I include the N/config module.

    I get similar errors if I try to use the older function, nlapiLoadConfiguration.

    [Error] Error: Invalid path; unable to load module /SuiteScripts/PayStand/PaymentEmbed: Module does not exist: N/config.js

    loadCallback (bootstrap.js:180)

    load (bootstrap.js:185)

    load (NsRequire.js:1769)

    load (NsRequire.js:927)

    fetch (NsRequire.js:917)

    check (NsRequire.js:947)

    enable (NsRequire.js:1250)

    enable (NsRequire.js:1641)

    (anonymous function) (NsRequire.js:1235)

    (anonymous function) (NsRequire.js:228)

    each (NsRequire.js:153)

    enable (NsRequire.js:1197)

    init (NsRequire.js:881)

    callGetModule (NsRequire.js:1277)

    completeLoad (NsRequire.js:1674)

    loadCallback (bootstrap.js:174)

    load (bootstrap.js:185)

    load (NsRequire.js:1769)

    load (NsRequire.js:927)

    fetch (NsRequire.js:917)

    check (NsRequire.js:947)

    enable (NsRequire.js:1250)

    enable (NsRequire.js:1641)

    (anonymous function) (NsRequire.js:1235)

    (anonymous function) (NsRequire.js:228)

    each (NsRequire.js:153)

    enable (NsRequire.js:1197)

    init (NsRequire.js:881)

    (anonymous function) (NsRequire.js:1546)

    [Error] Error: Load timeout for modules: N/config

    onError (bootstrap.js:119)

    onError (NsRequire.js:644)

    checkLoaded (NsRequire.js:793)

    (anonymous function) (NsRequire.js:812)
    This is a cached copy. Click here to see the original post.

  • #1803

    jpayne

    I found the correct method to use: in the runtime module.

    var scriptObj = runtime.getCurrentScript();

    var publishableKey = scriptObj.getParameter({name: ‘custscriptps_publishable_key’});

  • #1804

    chanarbon

    Hi @jpayne,

    Just a quick reminder,

    For your use case, runtime module is the best fit. Please note that config module loads configurations like company information and it is used on server side. Script parameters, users information and session details can be fetched on runtime module.

You must be logged in to reply to this topic.