Here is the X++ code to send the custom notification alert in Ax 2012.
static void SendNotificationAlert(Args _args)
{
    EventInbox  EventInbox,inbox;
    EventInboxData  eventInboxData;
    SysUserInfo SysUserInfo;
    int64 inboxId;
    ;
    ttsBegin;
        select SysUserInfo 
            order by SysUserInfo.Id 
            where SysUserInfo.Id== curUserId();
    { 
        select maxof(inboxId) from inbox;
        inboxId = EventInbox::nextEventId();
        EventInbox.CompanyId              =   curext();
        EventInbox.AlertTableId           =   212;
        EventInbox.AlertCreatedDateTime   =   DateTimeUtil::utcNow();
        EventInbox.ParentTableId          =   212;
        EventInbox.IsRead                 =   NOYES::No;
        EventInbox.Subject                =   "Notification Received ..";
        EventInbox.AlertedFor             =   "Notification Testing .. "; 
        EventInbox.UserId                 =   SysUserInfo.Id;
        EventInbox.ShowPopup              =   NOYES::Yes;
        EventInbox.Visible                =   NOYES::Yes;
        EventInbox.Message                =   'Notification Received ..!!';
        EventInbox.NotificationType       =   EventNotificationType::Information;
        EventInbox.insert();
        eventInboxData.DataType           =  EventInboxDataType::Context;
        eventInboxData.InboxId            =  inboxId;
        eventInboxData.insert();
        info("Notification sent");
    }
    ttsCommit;
}
Wonderful Article. Thanks for sharing this post
ReplyDeleteMicrosoft Dynamics 365 Training In Hyderabad
Excellent Blog!! Thanks for valuable info.
ReplyDeleteBest IT Training Institutes in Hyderabad