I am missing the functionality to send messages to online users that existed in Axapta 3.0 and is now gone. Well, I thought you could use the "Alert" functionality introduced in DAX 4.0.
What to do:
1. make sure the user options are configured correctly (that means: set "Time poll interval" to 1 minute, set "Show popup" to "For all event rules")
2. make a button in the online user form that will open a dialog where you could enter your text
3. send the message to all users selected in the online user form datasource
Here is a little job that creates an alert for a user. Remember this is a quick & dirty solution, so there are some drawbacks:
* you will get an error in the alert form on the second tab
* the message will only be displayed about 15 sec and disappears afterwards (you can check FRM EventAttentionGrabber to change that. Check methods fadeIn and fadeOut for variable opacity. This should give you a hint on how to display the form longer)
* the message will stay as unread until the user marks it as read
So you see there's lot of room to improve it... 8-)
Remember also to replace the "curuserid()" with the user id you want the alert to be sent to.
This is merely meant as an idea on how you can achieve sending messages to a user.
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 = "Message you want to send to user";
inbox.SendEmail = false;
inbox.UserId = curUserID();
inbox.InboxId = inboxId;
inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
inbox.insert();
}
or
EventInbox inbox;
inbox.initValue();
inbox.ShowPopup = NoYes::Yes;
inbox.Subject = "This is the Alert subject";
inbox.Message = "This is the Alert message";
inbox.AlertedFor = "This alert is just information no links are available";
inbox.SendEmail = false;
inbox.UserId = curuserid();
inbox.TypeId = classnum(EventType);
inbox.AlertTableId = tablenum(Address);
inbox.AlertFieldId = fieldnum(Address, Name);
inbox.TypeTrigger = EventTypeTrigger::FieldChanged;
inbox.CompanyId = curext();
inbox.InboxId = EventInbox::nextEventId();
inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
inbox.insert();
What to do:
1. make sure the user options are configured correctly (that means: set "Time poll interval" to 1 minute, set "Show popup" to "For all event rules")
2. make a button in the online user form that will open a dialog where you could enter your text
3. send the message to all users selected in the online user form datasource
Here is a little job that creates an alert for a user. Remember this is a quick & dirty solution, so there are some drawbacks:
* you will get an error in the alert form on the second tab
* the message will only be displayed about 15 sec and disappears afterwards (you can check FRM EventAttentionGrabber to change that. Check methods fadeIn and fadeOut for variable opacity. This should give you a hint on how to display the form longer)
* the message will stay as unread until the user marks it as read
So you see there's lot of room to improve it... 8-)
Remember also to replace the "curuserid()" with the user id you want the alert to be sent to.
This is merely meant as an idea on how you can achieve sending messages to a user.
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 = "Message you want to send to user";
inbox.SendEmail = false;
inbox.UserId = curUserID();
inbox.InboxId = inboxId;
inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
inbox.insert();
}
or
EventInbox inbox;
inbox.initValue();
inbox.ShowPopup = NoYes::Yes;
inbox.Subject = "This is the Alert subject";
inbox.Message = "This is the Alert message";
inbox.AlertedFor = "This alert is just information no links are available";
inbox.SendEmail = false;
inbox.UserId = curuserid();
inbox.TypeId = classnum(EventType);
inbox.AlertTableId = tablenum(Address);
inbox.AlertFieldId = fieldnum(Address, Name);
inbox.TypeTrigger = EventTypeTrigger::FieldChanged;
inbox.CompanyId = curext();
inbox.InboxId = EventInbox::nextEventId();
inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
inbox.insert();