Thursday 10 March 2016

How to identify the AOS server name /Instance Name In Axapta

Here is the code to identify the AOS server name /Instance Name In Axapta.

static void JobForAOSSeververInstantname(Args _args)
{
    xSession curSession;
    SysClientSessions clientSessions;
    SysServerSessions serverSessions;
    int usrSessionId;
    int serverId;
    str aosId;
    str instanceName;
    ;
    curSession = new xSession();
    usrSessionId = curSession.sessionId();
    select firstonly ServerId from clientSessions where clientSessions.SessionId == usrSessionId;
    serverId = clientSessions.ServerId;
    select firstonly * from serverSessions where serverSessions.ServerId == serverId;
    aosId = serverSessions.AOSId;
    instanceName = serverSessions.Instance_Name;
    info(instanceName);

}

No comments:

Post a Comment