scottvonduhn
03/11/2025, 3:08 PMCeligo AI
03/11/2025, 3:09 PMAI generated answer (using internal Slack threads):In SuiteScript, you can use the
runtime
module to detect if your script is running in a sandbox environment. The runtime.envType
property will return 'SANDBOX' if the script is running in a sandbox. However, this property does not distinguish between different sandboxes if you have more than one.
To identify a specific sandbox, you can use the runtime.accountId
property. This property will return a unique identifier for the account, which includes a suffix for the sandbox. For example, if you are in Sandbox 1, it might return '123456_SB1', and for Sandbox 2, it might return '123456_SB2'.
Here is a sample code snippet:
javascript
var runtime = require('N/runtime');
var environment = runtime.envType;
var accountId = runtime.accountId;
if (environment === 'SANDBOX') {
if (accountId.endsWith('_SB1')) {
// Code for Sandbox 1
} else if (accountId.endsWith('_SB2')) {
// Code for Sandbox 2
}
}
Please note that the suffixes '_SB1' and '_SB2' are just examples. The actual suffixes may vary depending on your NetSuite setup.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Aaron McCausland
03/11/2025, 3:09 PMCeligo AI
03/11/2025, 3:10 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840657532
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824641585
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81959188
Celigo AI
03/11/2025, 3:10 PMAaron McCausland
03/11/2025, 3:10 PM