This isProduction function will check whether the account Environment is production or not. It will return true if it is production.
/**
* Check whether the account is production or not.
* @returns {boolean}
*/
function isProduction() {
let ns_companyid = runtime.accountId.toString().trim().toLowerCase();
if (!Number.isNaN(Number(ns_companyid))) //Will be NaN for Sandbox or Release Preview accounts
return true;
return false;
}