Terminate sessions and close client window

Hi guys!

I have a requirement for preventing multiple sessions for a specific user.

Please help guys!

Thanks!

Regards,

AML

Find it here.

Hi Vishal Tiwari

How about terminating and shutting down the previous session?

Looking forward to hear from you very soon.

Thanks!

Regards,

AML

Basically that depends on your requirement, if you want you can do that. Change the code as per your need.

Hi Vishal,

I can terminate the previous session but I don’t know how to shutdown it. The window of the previous session is still visible. I use the function “this.shutdown” but it will shutdown the newly opened session. do you have any suggestions?

Looking forward to hear from you.

Thanks!

Regards,

AML

Find the session id of the previous opened AX using session.sessionId().

And use info.shutdown(true) where the session is of previous AX.

Hi Vishal,

Please check my code:

SELECT * FROM SysClientSessions
ORDER BY SysClientSessions.LoginDateTime ASC
WHERE SysClientSessions.userId == userId
&& SysClientSessions.Status == 1; //SELECT THE PREVIOUS ACTIVE SESSION

OrigSessionId = SysClientSessions.SessionId; //GET THE FIRST SESSION OF THE USER

session = new session(OrigSessionId); //SELECT WHAT SESSION TO TERMINATE
IF(session)
{
session.terminate(session.loginDate(), session.loginTime()); //TERMINATE SESSION
}

Regards,

AML

HI AML,

Even i have the same requiorement are you able to complete the functionality. If means can you please send me the code to pavan1363@gmail.com

Regards

Pavan