Generate notification in AX through code



static void initFromPaymentJournal(DataAreaId Companyid,LedgerJournalId JournalId)
{
EventInbox EventInbox,inbox;
SysUserInfo SysUserInfo;
;
ttsBegin;
while select SysUserInfo order by SysUserInfo.Id where SysUserInfo.Id!=”"
//while select maxof(inboxId) from inbox where
{
select maxof(inboxId) from inbox;
EventInbox.InboxId = EventInbox::nextEventId();
EventInbox.CompanyId = Companyid;
EventInbox.AlertTableId = 212;//2271;
EventInbox.AlertCreatedDateTime = DateTimeUtil::utcNow();
EventInbox.ParentTableId = 212;//2271;
EventInbox.IsRead = NOYES::No;
EventInbox.Subject = “Payment Journal Posting Created”;
EventInbox.AlertedFor = “Post created”;
EventInbox.UserId = SysUserInfo.Id;
EventInbox.ShowPopup = NOYES::Yes;
EventInbox.Visible = NOYES::Yes;
EventInbox.Message = strfmt(“Paymentjournal Post created for %1″,JournalId);
EventInbox.insert();
}
ttsCommit;
}

No comments

Powered by Blogger.