Thursday, 30 August 2018

Multiple Client Sessions issue in ax 2012

void startupPost()
{
    xSession session;
    SysClientSessions SysClientSessions;
    UserId currentUserId;
    int counter;
    ;
    currentUserId = curUserId();
    if(currentUserId!="Admin")
    {
        while select SysClientSessions
            where SysClientSessions.userId == currentUserId
               && SysClientSessions.Status == 1
        {
            session = new xSession(SysClientSessions.SessionId, true);
            if (session && session.userId())
            {
                counter++;
            }
        }
        if(counter>=2)
        {
            Box::stop("Already Logged-in : The same user id can’t log in twice.");
            infolog.shutDown(true);
        }
    }
}

No comments:

Post a Comment

DefaultDimension in d365 FO X++

 Navigate to PurchTable methods you can find with DefaultDimension this.DefaultDimension = this.mergeDimension(this.getDefaultDimension(),th...