N/runtime Module Members for SuiteScript Development
Use the N/runtime module to manage script, session, and user settings in SuiteScript.
The N/runtime module in SuiteScript provides flexibility in managing runtime settings for scripts, sessions, and users. This module is crucial for developers looking to interact with script behaviors and user contexts in both client and server scripts.
What Does the N/runtime Module Offer?
The N/runtime module offers key functionalities that allow developers to query and manipulate runtime settings within the NetSuite platform. It is particularly advantageous for managing session keys and checking feature enablements.
Main Components and Functions
The N/runtime module includes several objects and methods with specific purposes:
- runtime.Script: Encapsulates settings for the currently executing script.
- runtime.Session: Represents the user session tied to the executing script.
- runtime.User: Contains properties and preferences of the user executing the script.
- runtime.getCurrentScript(): Returns a
runtime.Scriptobject. - runtime.getCurrentSession(): Returns a
runtime.Sessionobject. - runtime.getCurrentUser(): Returns a
runtime.Userobject. - runtime.isFeatureInEffect(options): Checks if a specific feature is enabled.
Key Properties
The module provides several properties to access runtime details:
| Property | Type | Description |
|---|---|---|
runtime.accountId | string | The current user's account ID. |
runtime.country | string | The company's country. |
runtime.envType | string | The current script's execution environment. |
runtime.executionContext | string | Trigger context of the current script. |
runtime.version | string | The NetSuite version in which the script is called. |
Enumerations
- runtime.ContextType: Context values for script execution triggers.
- runtime.EnvType: Possible environment types for script execution.
- runtime.Permission: User permission levels for specific IDs.
Who This Affects
This module is particularly useful for:
- Developers: Who need to customize or interact with script behaviors and user sessions.
- Administrators: Managing configuration and feature enablements within the account.
Key Takeaways
- The N/runtime module is essential for script and session management in SuiteScript.
- It includes objects for accessing runtime settings of the script, session, and user.
- It supports both client and server scripts, making it versatile for various script applications.
Frequently Asked Questions (4)
Do I need to enable a specific feature flag to use the N/runtime module in my scripts?
What happens if a script tries to access a property of `runtime.User` in an environment with limited user permissions?
Is it possible to check which features are enabled in my NetSuite account using the N/runtime module?
How does the `runtime.executionContext` property affect the behavior of a script?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Custom Tool Script Enhancements in NetSuite
Custom tool scripts in NetSuite gain execution log support and a new management page in February 16, 2026.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
