N/runtime Module Members for SuiteScript Development

Use the N/runtime module to manage script, session, and user settings in SuiteScript.

·2 min read·View Oracle Docs

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.Script object.
  • runtime.getCurrentSession(): Returns a runtime.Session object.
  • runtime.getCurrentUser(): Returns a runtime.User object.
  • runtime.isFeatureInEffect(options): Checks if a specific feature is enabled.

Key Properties

The module provides several properties to access runtime details:

PropertyTypeDescription
runtime.accountIdstringThe current user's account ID.
runtime.countrystringThe company's country.
runtime.envTypestringThe current script's execution environment.
runtime.executionContextstringTrigger context of the current script.
runtime.versionstringThe 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?
No, the N/runtime module is available for use in both client and server scripts without needing to enable a specific feature flag.
What happens if a script tries to access a property of `runtime.User` in an environment with limited user permissions?
If a script accesses `runtime.User` properties when the user has limited permissions, the script will only be able to retrieve the properties and preferences that the user has access to based on their permission level.
Is it possible to check which features are enabled in my NetSuite account using the N/runtime module?
Yes, the `runtime.isFeatureInEffect(options)` method allows you to determine if a specific feature is enabled in your NetSuite account.
How does the `runtime.executionContext` property affect the behavior of a script?
The `runtime.executionContext` property indicates the context in which the current script is triggered, helping developers tailor the script's behavior based on the specific execution context.
Source: N/runtime Module Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in SuiteScript

View all SuiteScript articles →