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)

Creating email alerts from the code

(0) ShareShare
ReportReport
Posted on by 10

Hi everyone,

First of all, let me say that I am very new to Dynamics Ax so sorry if this is a stupid question.

So my problem is that I need to setup an email alert when an activity of type "Appointment" is created. The alert should be triggered 1 hour before the appointment is due. I'm not quite sure how to do this as we are not integrating Dynamics with Outlook.

So here is what I managed to do so far:

- I made sure that the "E-mail distributor batch" process was running. To be sure of that I've set an email alert on it to be send when the process has finished. It worked fine and I was receiving emails and pop-ups.

- I manage to somehow create an alert from the code, using something along these lines:

 inboxId = EventInbox::nextEventId();

    inbox.initValue();
    inbox.ShowPopup = NoYes::Yes;
    inbox.Subject = "The new activity has been created";
    inbox.Message = "Don't forget about it please.";
    inbox.SendEmail = true;
    inbox.UserId = curUserID();
    inbox.AlertTableId = 2271;
    inbox.ParentTableId = 2271;
    inbox.AlertedFor = "Event: Activity updated";
    inbox.EmailRecipient = myEmail@myDomain.com;
    inbox.TypeId = classnum(eventTypeDue);
    inbox.TypeTrigger = EventTypeTrigger::DueType;

    inbox.InboxId = inboxId;

    inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();

    inbox.insert();

The code above is creating the alert and I'm getting the popup.

My problem is that in this case the email is not sent...

Also, in this case the alert is sent straight away and I haven't really found a way to delay it to be send at the time I want.

And that's it, I'm stuck there. Does anyone have a solution to my problem?

Also, I had a look at the activities of type "Reminder" but those ones are valid only when integrating with Outlook right?

 Thanks for your help.

Regards

 

*This post is locked for comments

I have the same question (0)
  • Fabien Ruffin Profile Picture
    10 on at

    By the way, I forgot to mention that this alert should apply to all users. What I mean is that by default, all users should automatically receive an email reminding them of the appointment activity they create.

     Thanks

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#1
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#1
Pratik Bhosle Profile Picture

Pratik Bhosle 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans