Session.set(options)
Method Description |
Sets a key and value for a user-defined session object. Use Session.get(options) to retrieve the object value after you set it. |
Returns |
void |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string |
required |
Key used to store the session object. |
2015.2 |
|
string |
required |
Value to associate with the key in the user session. |
2015.2 |
Errors
Error Code |
Thrown If |
---|---|
|
The |
Syntax
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