web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Which class is triggered during Alerts notifications in AX 2012

(1) ShareShare
ReportReport
Posted on by 692

Hi All,

I added User group field in create alert rule form.

2017_2D00_04_2D00_13-_2800_2_2900_.png

I want to send alert notifications to all users in above usergroup.

To achieve this in which class do i need to implement my code.

I tried in 

EventNotification, EventNotificationSync Classess create method.

but it won't be useful.

Can anyone guide me correct direction. for achieving the above requirement

Thanks,

Krishna

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    You could have used cross-references to find it yourself easily. The table where the alert is originally inserted is EventCUD, from which the alerts are generated and sent to the users' EventInbox.

    Take a look at EventJobCUDTask.run() and .runCudEventsForUser(), which is the change based alerts batch for an idea.

  • Suggested answer
    Zain Bokhari Profile Picture
    3,208 Moderator on at

    Hi Krishna,

    Instead of trying to change the implementation of an existing class why don't you write a batch job and implement your logic there with the help of EventNotification class.

    I once implemented a similar code that sent users in a particular group notifications based on required logic. 

  • gsbsrk b Profile Picture
    692 on at

    Thanks  Vilmos and Zain.

    public EventInboxId create(EventInbox          inbox)

    {

       EventInbox              eventInbox;

       EventInboxData          eventInboxData,eventInboxData1;

       EventInboxId            inboxId;

       EventInbox          _inbox = EventInbox::find(inbox.InboxId);

       EventInboxData      _inboxData = EventInboxData::find(inbox.InboxId,EventInboxDataType::Context);

       EventInboxData      _inboxData1 = EventInboxData::find(inbox.InboxId,EventInboxDataType::TypeData);

       EventRule               eventRule = EventRule::find(_inbox.RuleId);

       UserGroupList           userGroupList;

       if(eventRule.id)

       {

           while select userGroupList where userGroupList.groupId == eventRule.id &&

              userGroupList.userId != _inbox.UserId

           {

               inboxId                             = EventInbox::nextEventId();

               eventInbox.InboxId                  = inboxId;

               eventInbox.ShowPopup                = NoYes::Yes;

               eventInbox.Subject                  = _inbox.Subject;

               eventInbox.Message                  = _inbox.Message;

               eventInbox.AlertedFor               = _inbox.AlertedFor;

               eventInbox.SendEmail                = _inbox.SendEmail;

               eventInbox.UserId                   = userGroupList.userId;

               eventInbox.RuleId                   = _inbox.RuleId;

               eventInbox.TypeId                   = _inbox.TypeId;

               eventInbox.ParentTableId            = _inbox.ParentTableId;

               eventInbox.AlertTableId             = _inbox.AlertTableId;

               eventInbox.AlertFieldId             = _inbox.AlertFieldId;

               eventInbox.AlertFieldLabel          = _inbox.AlertFieldLabel;

               eventInbox.GlobalRule               = _inbox.GlobalRule;

               eventInbox.TypeTrigger              = _inbox.TypeTrigger;

               eventInbox.CompanyId                = _inbox.CompanyId;

               eventInbox.AlertCreatedDateTime     = _inbox.AlertCreatedDateTime;

               eventInbox.insert();

               eventInboxData.InboxId = inboxId;

               eventInboxData.DataType = EventInboxDataType::Context;

               eventInboxData.Data = _inboxData.Data;

               eventInboxData.insert();

               eventInboxData1.InboxId = inboxId;

               eventInboxData1.DataType = EventInboxDataType::TypeData;

               eventInboxData1.Data = _inboxData1.Data;

               eventInboxData1.insert();

           }

       }

       return inbox.InboxId;

    }

    This is my code

    I want alert rule and  Event inbox info based on that i can insert alert notification to users in that particular user group.

    For Ex Employee status filed i create alert rule.

    If employee status got changed i need to send alert notifications.

    Please guide me in right direction.

    Thanks,

    Krishna

  • Verified answer
    gsbsrk b Profile Picture
    692 on at

    Hi All,

    EventActionAlert is the class to create alert notifications in AX 2012 R2

    I just put my code in a new method and i called that method in Execute method.

    Thanks guys

    Krishna

  • Norseman Profile Picture
    55 on at

    Krishna,

    I have exactly similar requirement by my user. The above code doesn't compile, as there is no Id in EventRule table. Also how did you call from EventActionAlert's execute method? Could you please post more details? I really appreciate your time.

    Thanks,

    Vivek

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 24

#2
Michel ROY Profile Picture

Michel ROY 14

#3
Jagadabi Profile Picture

Jagadabi 6

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans