Force Logout Users in all Nodes

D_8
Tera Contributor

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 ?

1 ACCEPTED SOLUTION

ARG645
Tera Guru

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.

View solution in original post

6 REPLIES 6

We'd like to display messages on their browser. How do you write the code in BR?

 

Thanks.

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');