Источник:
http://rusgon.blogspot.com/2008/01/s...e-to-user.html
==============
Following job illustrates how to send message to user in AX 3.0
X++:
static void JobSendMessage(Args _args)
{
AOSSessionInfo testSession;
int counter;
int maxSessions;
container users;
int sesId;
userId userId;
ClientType clientKind;
date logindate;
int logintime;
str clientComputerName;
str databaseSpid;
str itemSTr;
userName userName;
AOSClientMode clientMode;
int sessionCount;
int idleTicks;
str recipient = curuserid();// place here addressee userid
int recSesId = -1;
;
[ users, maxSessions ] = SysUsersOnline::getAllOnlineUserInfo();
for(counter = 1; counter <= maxSessions; counter++)
{
[ sesId,
userId,
clientKind,
loginDate,
loginTime,
clientComputerName,
databaseSpid,
userName,
clientMode,
idleTicks
] = conPeek(users, counter);
if(userId == recipient)
{
recSesId = sesId;
break;
}
}
if(recsesId != -1)
{
testSession = new AOSSessionInfo(recsesId);
if (testSession)
{
AOSSessionInfo::sendMessage(
recsesId, strfmt("@SYS55325", curuserid(), time2str(timenow(),0,0)),
"Hello!");
box::info("Delievered");
}
}
else
{
throw error(strFmt("User %1 is offline.", recipient));
}
}