Search This Blog

Tuesday, November 24, 2015

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

Hi Folks,

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

}

Thanks,
Brahma