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

  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
nmaenpaa Profile Picture

nmaenpaa 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans