Session.get(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Returns the user-defined session object value associated with a session object key.

Both the session object value and associated key are defined using Session.set(options) (supported in server scripts only).

If the key does not exist, this method returns null.

Returns

string | null

Supported Script Types

Client and server scripts

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

Governance

None

Module

N/runtime Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.name

string

required

Key used to store the session object.

2015.2

Errors

Error Code

Thrown If

SSS_MISSING_REQD_ARGUMENT

The options.name parameter is not specified.

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.set({
    name: 'myKey',
    value: 'myValue'
});
log.debug('Session object myKey value: ' + sessionObj.get({name: 'myKey'});
...
// Add additional code 

        

Related Topics

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

General Notices