Monday, June 02, 2008

Send message to online user in Dynamics AX 4.0

Remember also to replace the "curuserid()" with the user id you want the alert to be sent to.

static void sendAlert(Args _args)
{
EventInbox inbox;
EventInboxId inboxId;

inboxId = EventInbox::nextEventId();

inbox.initValue();
inbox.ShowPopup = NoYes::Yes;
inbox.Subject = "Message to online user";
inbox.Message = "Hi team, i want to restart my aos service, please save your work";
inbox.SendEmail = false;
inbox.UserId = curUserid();

inbox.InboxId = inboxId;

inbox.AlertCreatedDate = systemdateget();
inbox.AlertCreateTime = timeNow();

inbox.insert();
}

No comments: