When you require the NetSuite account ID or root URL in your SuiteScript, it is recommended that you do not use a hard-coded string. This allows the code to be ported to other environments quickly and easily.
Best practice: Do not hard code in NetSuite account IDs or root URLs for a NetSuite account!
let accountId = runtime.accountId;
Use the “runtime” module and “runtime.accountId” to grab the current NetSuite account ID.
Note: This value is read-only (for good reason).
let scheme = 'https://';
let host = url.resolveDomain({
hostType: url.HostType.APPLICATION,
accountId: "12345" //THIS IS OPTIONAL, AND LIKELY NOT REQUIRED
});
Note: Other “root” domains for the NetSuite account are available using different “hostType"s. See the url module documentation for more details.
Related Article: Formatting Strings as Currency | SuiteCommerce
We like to update our blogs and articles to make sure they help resolve any troubleshooting difficulties you are having. Sometimes, there is a related feature to enable or a field to fill out that we miss during the instructions. If this article didn't resolve the issue, please use the chat and let us know so that we can update the article!
Tagged with Training