I figured out how to use `Configuration` in SS2.0 ...
# suitecommerce
m
I figured out how to use
Configuration
in SS2.0 services so sharing with the community. You can access the default plus extensions configuration like this in ss2 service model (screenshot 1) Sample response I tested with: cancelUrlRoot is the default config (I just appended '/admin' so that it picks the updated value) trainConfig is the config from my custom extension (screenshot 2). Specify the relative path like this for Configuration module in
define
dependencies
../../../../../../../_suitescript/SC/Libraries/Configuration/Configuration
❤️ 2
👏🏻 1
👍🏻 1
b
Can’t wait to try it!!! Thank you so much for sharing!! 🙏🏻 🙏🏻 🙏🏻
🤘 1
@Mohammad Sharaf Ali Hi! It is time to start implementing this solution 🙂 . I do not know whats the path to the Configuration Module.
Hrmm nvm i think i got it 🙂
Hrmm I am getting the error that that module does not exist.
"Module does not exist: /Web Site Hosting Files/Live Hosting Files/SSP Applications/NetSuite Inc. - SCA 2022.2.0/Development2/extensions/AFG/BackInStockNotification/Backend/SC/Libraries/Configuration/Configuration.js
m
Your path is being resolved wrongly as the default logic in core is to look into the extension but we need it to point it to core backend. Just specify the relative path like this
../../../../../../../_suitescript/SC/Libraries/Configuration/Configuration
.
🙌 1
b
Ok, will try that. Thank you!! 🙂
So like this: define(['../../../../../../../_suitescript/SC/Libraries/Configuration/Configuration','N/record', 'N/runtime', 'N/search', 'N/file'], function Configuration (Configuration, record, runtime, search, file) {
Or should i define it inside the [ ] brackets?
m
Like this
🙌 1
b
Thank you!
🤘 1
So when i log.debug the instance of the config i get this: {"recordType":"customrecord_ns_sc_configuration","custrecordNsSccKey":"custrecord_ns_scc_key","custrecordNsSccValue":"custrecord_ns_scc_value"}
I need the subsidiary, the shopper siteid and currency.
m
With config you can fetch values from the domain site configuration screen e.g. where you see nav links, facet fields naming etc
There is an Environment module that you can include and check if it has methods for the data you need. Else you can simply pass the values from the SC global in the get params from your frontend model and consume values in the backend.
🙌 1
b
Hi @Mohammad Sharaf Ali hope you're doing great! Question, do you know how to use the Utils module inside a backend Model ss2 file?
c
This works well, great job!