Identify sandbox and production

Differentiate production account and sandbox account using the host

To get the host id we can use

var host = url.resolveDomain({ hostType: url.HostType.APPLICATION});

It returns a domain name for a NetSuite account.

options.hostType : The type of domain name you want to retrieve. Set this value using the url.HostType enum.

options.accountId :

The NetSuite account ID for which you want to retrieve data. If no account is specified, the system returns data on the account that is running the script.

You can find the account ID at Setup > Company > Company Information in the Account ID field.

example host id : AccountId.app.netsuite.com

Leave a comment

Your email address will not be published. Required fields are marked *