N/runtime Module

Use the N/runtime module to view runtime settings for the script, the session, or the user. You can also use this module to set a session key and to see whether a particular feature is enabled in your account.

                                   

In This Help Topic

N/runtime Module Members

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Object

runtime.Script

Object

Client and server scripts

Encapsulates the runtime settings of the currently executing script.

runtime.Session

Object

Client and server scripts

Encapsulates the user session for the currently executing script.

runtime.User

Object

Client and server scripts

Encapsulates the properties and preferences of the user currently executing the script.

Method

runtime.getCurrentScript()

runtime.Script

Client and server scripts

Returns a runtime.Script object that represents the currently executing script.

runtime.getCurrentSession()

runtime.Session

Client and server scripts

Returns a runtime.Session object that represents the user session for the currently executing script.

runtime.getCurrentUser()

runtime.User

Client and server scripts

Returns a runtime.User object that represents the properties and preferences of the user currently executing the script.

runtime.isFeatureInEffect(options)

boolean

Client and server scripts

Indicates whether a particular feature is enabled in a NetSuite account.

These are the features that appear on the Enable Features page.

Property

runtime.accountId

string (read-only)

Client and server scripts

The account ID for the current user.

runtime.country

string (read-only)

Client and server scripts

The country for the current company.

runtime.envType

string (read-only)

Client and server scripts

The current environment in which the script is executing.

This property uses values from the runtime.EnvType enum.

runtime.executionContext

string (read-only)

Client and server scripts

The trigger of the current script.

This property uses values from the runtime.ContextType enum.

runtime.processorCount

number (read-only)

Client and server scripts

The number of processors available to the current account.

runtime.queueCount

number (read-only)

Client and server scripts

The number of scheduled script queues available to the current account.

runtime.version

string (read-only)

Client and server scripts

The version of NetSuite that the method is called in. For example, this property in an account running NetSuite 2015.2 is 2015.2.

Enum

runtime.ContextType

enum

Client and server scripts

Holds the context values for script triggers.

This is the type for the runtime.executionContext property.

runtime.EnvType

enum

Client and server scripts

Holds all possible environment types that the current script can execute in.

This is the type for the runtime.envType property.

runtime.Permission

enum

Client and server scripts

Holds the user permission level for a specific permission ID.

This is the type returned by the User.getPermission(options) method.

Script Object Members

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

Script.getParameter(options)

number | Date | string | boolean

Client and server scripts

Returns the value of a script parameter for the currently executing script.

Script.getRemainingUsage()

number

Client and server scripts

Returns the number of units remaining (per governance limitations) for the currently executing script.

Property

Script.apiVersion

string (read-only)

Client and server scripts

The current script’s runtime version.

Script.bundleIds

Array (read-only)

Client and server scripts

An array of bundle IDs for the bundles that include the currently executing script.

Script.deploymentId

string (read-only)

Server scripts

The deployment ID for the script deployment of the currently executing script.

Script.id

string (read-only)

Client and server scripts

The script ID for the currently executing script.

Script.logLevel

string (read-only)

Server scripts

The script logging level for the currently executing script.

Script.percentComplete

number

Client and server scripts

The percent complete for the current scheduled script execution. This value will appear in the % Complete column on the Scheduled Script Status page.

Session Object Members

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

Session.get(options)

string | null

Server scripts

Returns the user-defined session object value associated with the session object key. Both the session object value and associated key are defined using Session.set(options).

Session.set(options)

void

Server scripts

Sets a key and value for a user-defined session object.

User Object Members

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

User.getPermission(options)

string

Client and server scripts

Returns a runtime.Permission user permission level for the specified permission.

User.getPreference(options)

string

Client and server scripts

Returns the value of a NetSuite preference.

Currently only General Preferences and Accounting Preferences are exposed in SuiteScript. For more information about these preferences, see General Preferences and Accounting Preferences.

Property

User.contact

number(read-only)

Client and server scripts

The internal ID of the currently logged-in contact.

User.department

number (read-only)

Client and server scripts

The internal ID of the department for the current user.

User.email

string (read-only)

Client and server scripts

The email address of the current user.

User.id

number (read-only)

Client and server scripts

The internal ID of the current user.

User.location

number (read-only)

Client and server scripts

The internal ID of the location of the current user.

User.name

string (read-only)

Client and server scripts

The name of the current user.

User.role

number (read-only)

Client and server scripts

The internal ID of the role for the current user.

User.roleCenter

string (read-only)

Client and server scripts

The string value of the center type, or role center, for the current user.

User.roleId

string (read-only)

Client and server scripts

The custom scriptId of the role for the current user.

User.subsidiary

number (read-only)

Client and server scripts

The internal ID of the subsidiary for the current user.

Related Topics

SuiteScript 2.x Modules
SuiteScript 2.x

General Notices