Create and send alert to user in MSD Axapta by code

EventInbox is a table where alert message record stored. You can try following code to check the same using job in axapta.

static void CreateAlertInAx(Args _args)
{
Eventinbox Alerbox;
;
Alerbox.initValue();
Alerbox.ShowPopup = NoYes::Yes;
Alerbox.Subject = "This is the Alert subject";
Alerbox.Message = "This is the Alert message";
Alerbox.AlertedFor = "This alert is just information testing";
Alerbox.SendEmail = false;
Alerbox.UserId = curuserid();
Alerbox.TypeId = classnum(EventType);
Alerbox.AlertTableId = tablenum(Address);
Alerbox.AlertFieldId = fieldnum(Address, Name);
Alerbox.TypeTrigger = EventTypeTrigger::FieldChanged;
Alerbox.CompanyId = curext();
Alerbox.AlerboxId = EventAlerbox::nextEventId();;
Alerbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
Alerbox.insert();
}