Показать сообщение отдельно
Старый 26.01.2008, 18:22   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
Ruslan Goncharov: Sending message to user
Источник: 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));
    }
}
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.