Skip to content

Commit 7b1f276

Browse files
GlideSystem - GlideSession API scripts (#253)
* Create session.js * Create readme.md * Rename GlideSystem/readme.md to GlideSystem/Session/readme.md
1 parent 1cf62f8 commit 7b1f276

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

GlideSystem/Session/readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
GlideSystem (referred as "gs") is used to get the current user session which we are using to set the custom key and value which are used in client side scripts.
2+
3+
Example client script used to retrieve it,
4+
5+
function onLoad(){
6+
var value = g_user.getClientData("custom_key");
7+
console.log("Client data "+value);
8+
}

GlideSystem/Session/session.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//Get user session object.
2+
var session = gs.getSession();
3+
4+
//Set value for custom key
5+
session.putClientData("custom_key","custom_value");
6+
7+
//Print the value for the key supplied
8+
gs.print(session.getClientData("custom_key"));

0 commit comments

Comments
 (0)