- 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
04-01-2019 10:22 PM
We'd like to display messages on their browser. How do you write the code in BR?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2019 12:36 PM
Use the below code to display the message to the user before logging out.
gs.sleep(2000)// 2000 milliseconds is 2 seconds
gs.addInfoMessage('You are about to be Logged out');