- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 04:23 PM
I have a business rule that is trying to force Logout users using the below script
var gr = new GlideRecord('v_user_session');
gr.addEncodedQuery('user=YOURIDHERE');
gr.query();
while(gr.next()){
gr.locked = true;
}
But the problem is in production we have around 12 nodes, and the above script works logs out users from a specific node that is assigned at the time but all nodes. If my user is in Node A, and when the business rule runs under another user who is in Node B, then the script wont logout the user. Node assignment seems to be random.
Any Idea how to solve this ?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 04:26 PM
Dustin,
Try using the below method (this wont work in Scoped apps I believe). Pass the User name as the parameter.
GlideSessions.lockOutSessionsInAllNodes('user_name');
Thank you,
Aman Gurram
Please mark the answer as correct/helpful if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 04:26 PM
Dustin,
Try using the below method (this wont work in Scoped apps I believe). Pass the User name as the parameter.
GlideSessions.lockOutSessionsInAllNodes('user_name');
Thank you,
Aman Gurram
Please mark the answer as correct/helpful if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2018 04:28 PM
aaah I tried this method. I was passing in the sys_id of the user as the parameter.
I tested it just now by passing in the User ID and it works.
Thank you Gurram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019 11:45 PM
Can we send a message to the user logged out? We want him know the reason.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2019 10:11 AM
Yes, you can. Depends on how you want to inform them. You can send them a notification, or display an error message before locking them out.