January 02, 2013

How to Restrict Multiple Time login of a same user

Hi Folks,

Many times intentionally or unintentionally a user may open multiple session of AX. That surly impact your performance. So here is a fix,
1.     Go to AOT
2.     Open class ‘Info’
3.     Copy Paste the Following Code in startupPost method.

void startupPost ()
// To restrict user login form second login
xSession session;
SysClientSessions SysClientSessions;
UserId currentUserId;
int counter;
currentUserId = curUserId();
if(currentUserId!="Admin")// only Admin User is allowed to login multiple time
while select SysClientSessions
where SysClientSessions.userId == currentUserId &&
SysClientSessions.Status == 1 // 1 : Login 0 : Logout
session = new xSession(SysClientSessions.SessionId, true);
if (session && session.userId())
Box::stop("Already Logged-in : The same user id can't log in twice.");

Please take backup of your application before copying code



  1. Hi,

    I have tried this, and it works great for restricting access for multiple sessions. However, I am an admin, and it wont allow me to log on with multiple sessions. Could it be because I have other user groups as well?


    1. Hi Thor,

      It will work on the basis of user id not on user group.

      Are you tries to use "Admin: as your user id?

  2. Hi,
    I have tried this one and it doesn't work for normal users. it required some admin permission.
    it looks like that normal users don't have permission to access SysClientSessions table.
    any idea please




Note: Only a member of this blog may post a comment.