Показать сообщение отдельно
Старый 24.11.2011, 11:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
daxdilip: Tip - How to Retrieve AOS Instance name in Dynamics AX via X++ Code
Источник: http://feedproxy.google.com/~r/blogs...ance-name.html
==============
One of my mates asked me how to retreive AOS Instance name through code. My first impression was that it should be somewhere in the Global Class. But, soon figured out I was wrong, then I jumped into Session Class which has a static method getAOSInstance() which retreives the instance number

The requirement here was to extract the instance name. Suddenly, it striked me, that in standard AX in Administration > Online Users form, the last column shows the AOS instance name.

So, the next step was to go through AOT > Forms > SysOnlineUsers > display method getAOSInstanceName() - here the key is serverSessions.aosId and serverSessions.Instance_Name - combination of both will give you the aos instance.

X++:
//BP Deviation documented
display ServerId getAOSInstanceName(SysServerSessions serverSessions)
{
    ServerId            sid = '';
    str                 aosId, machineName, instanceName;
    int                 pos;
    #DEFINE.ATSYMBOL('@')
    ;
    aosId = serverSessions.aosId;
    instanceName = serverSessions.Instance_Name;    pos = strfind(aosId, #ATSYMBOL, 1, strlen(aosId));
    machineName = substr(aosId, 1, pos-1);
    sid = instanceName + '@' + machineName;
    return sid;
}
Sometimes Googling within AX helps Njoi ;-)



Источник: http://feedproxy.google.com/~r/blogs...ance-name.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось Poleax; 24.11.2011 в 11:25. Причина: оформление