Destroy session
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 01:25 AM
Hi,
How can i destroy session with scripting in Service Portal.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 01:37 AM
Hi,
What you can do is make a Gliderecord query to v_user_session table, pick the logged in/whichever user and then set the locked field value to true.
This way, you can terminate the session through the script. Let me know if you need help with the script.
Please mark it correct/helpful based on the response.
Thanks
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 02:29 AM
Hi,
I need some help in script.
This is what i do on server side script :
var username = gs.getUserName();
var ses = new GlideRecord('v_user_session');
ses.get('user',username);
data.ses = ses.locked;
And i want to use the data.ses in client script to set the value of locked to true.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 03:31 AM
Hi,
With your script, you can get the current user locked status which would obviously be false is the user is logged in.
If you just want to display it in client script, you can use $scope.data.ses & it will give the status in client script.
Or if you want to set locked status at true i.e. destory the session, you can simply do in server script itself.
var username = gs.getUserName();
var ses = new GlideRecord('v_user_session');
ses.get('user',username);
ses.locked=true;
ses.update();
Please mark it correct/helpful based on the response.
Thanks
Gaurav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2018 04:00 AM
Hi ,
But i need to destroy session basing on a condition that i have in client script.
thanks.