runtime.Session

Note:

The content in this help topic pertains to SuiteScript 2.0.

Object Description

Encapsulates the user session for the currently executing script.

Use this object to set and get user-defined objects for the current user session. Use the objects to track user-related session data. For example, you can gather information about the user scope, budget, or business problems.

Use Session.set(options) to set session object values. Use Session.get(options) to retrieve session object values.

For a complete list of this object’s methods, see Session Object Members.

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/runtime Module

Since

2015.2

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/runtime Module Script Samples.

          // Add additional code 
...
var sessionObj = runtime.getCurrentSession(); //sessionObj is a runtime.Session object
sessionObj.set({
    name: 'myKey',
    value: 'myValue'
});
log.debug('Session object myKey value: ' + sessionObj.get({name: 'myKey'}));
...
// Add additional code 

        

Related Topics

N/runtime Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices