Hi,
Lets have the below code for Creating Alerts Programmatically using X++.
static void SendAlert(Args _s)
{
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();
}
By Default in AX, We have Change Based Alerts & Due Date Alerts but via code we can create custom alerts for RecodeInsert & RecordDelete as well.
See, EventTypeTrigger Base Enum for more details.
Enjoy DAX !!!
No comments:
Post a Comment
Thanks for your time reviewing this blog.