Script Object Members in SuiteScript for Developers

N/runtime module details runtime settings, session, and user data for script operations.

·2 min read·View Oracle Docs

The N/runtime module in NetSuite is pivotal for handling runtime settings related to scripts, sessions, and users. This module allows developers to access runtime information, set session keys, and verify feature availability within a NetSuite account.

How Do Script Object Members Work in NetSuite?

The Script object members within the N/runtime module enable developers to manage and access various runtime settings specific to the executing script.

Key Methods in Script Object Members

  • Script.getParameter(options): Returns the value for a parameter of the executing script, which can be a number, date, string, or boolean.
  • Script.getRemainingUsage(): Provides the remaining execution units under governance rules.

Essential Properties

  • Script.apiVersion: Read-only; shows the runtime version of the current script.
  • Script.bundleIds: Read-only; an array of bundle IDs relevant to the script.
  • Script.deploymentId: Read-only; displays the deployment ID for server scripts.
  • Script.id: Read-only; returns the ID for the current script.
  • Script.logLevel: Read-only; indicates the logging level for server scripts.
  • Script.percentComplete: Indicates the execution progress percentage for scheduled scripts.

Who This Affects

  • Developers: Those implementing or managing scripts will benefit from understanding runtime contexts.
  • Administrators: Need to ensure correct script execution and feature enabling.

Key Takeaways

  • N/runtime module is crucial for runtime script management in NetSuite.
  • Allows setting session keys and checking feature availability.
  • Script object members provide methods for parameter retrieval and runtime management.
  • Ensures adherence to governance limits via usage metrics.

Frequently Asked Questions (4)

How can I access user-specific configurations in a script using the N/runtime module?
You can use the `runtime.User` object provided by the N/runtime module to access properties and preferences of the user running the script. This is supported in both client and server scripts.
Are there any restrictions on accessing remaining governance units in SuiteScript?
You can use the method `Script.getRemainingUsage()` to return the remaining governance units for a script. This is available in both client and server scripts as part of the Script Object Members.
Is there a way to determine if a feature is enabled in the current NetSuite account using SuiteScript?
Yes, you can use the `runtime.isFeatureInEffect(options)` method of the N/runtime module to check if a feature is enabled in the account. This method can be used in both client and server scripts.
What information can be retrieved about a script's execution using the Script object?
The Script object provides various methods and properties such as `Script.apiVersion`, `Script.id`, and `Script.percentComplete` to retrieve information about the script's runtime version, ID, and execution progress, respectively.
Source: Script Object 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 →