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
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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category