Источник:
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