EventInbox code for notifications in AX:

Hi,
To send a notification to any user based on insertion or updation of a record, etc.. in a table, Use this code..
Below code helps You to send notifications to all the users who has permission to access the current application. Use the below code in post() method of ledgerjournalcheckpost class where the journal gets posted.

EventInbox code for notifications:

static void PostPaymentJournal()
{
EventInbox EventInbox,inbox;
SysUserInfo SysUserInfo;
JournalId JournalId;
;

JournalId = “ABC-000001″;
ttsBegin;
while select SysUserInfo
order by SysUserInfo.Id
where SysUserInfo.Id!=””
{
select maxof(inboxId) from inbox;
EventInbox.InboxId = EventInbox::nextEventId();
EventInbox.CompanyId = curext();
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(“Payment journal %1 has been Posted”, JournalId);
EventInbox.insert();
}
ttsCommit;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s