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 :
Small and medium business | Business Central, N...
Suggested Answer

AzureAD Application & Email

(0) ShareShare
ReportReport
Posted on by

Hello,

Is there a way to use the email functionality in AL when using an AzureAD Registered app? Our app makes a bunch of POST requests to populate Business Central tables, and after doing this we want it to send an email with the results. 

If I add an action to a page in BC and use the UI to trigger the codeunit, the email gets sent, but when our app is calling the codeunit nothing happens. 

procedure AlertNotify(header: Text[50]; message: Text[200])
    var
        TxtRecipientList: List of [Text];
        EmailObj: Codeunit "Email";
        EmailMsg: Codeunit "Email Message";
    begin
        TxtRecipientList.Add('info@ourcompany.com');

        EmailMsg.Create(
            TxtRecipientList,
            header,
            message,
            false
        );
        EmailObj.Send(EmailMsg, Enum::"Email Scenario"::"Notification");
    end;

Our AzureAD app has D365 Automation permissions, and we're telling it to use the shared mailbox email account that has had the Notification scenario applied.

Anyone got any ideas as to what's happening?

  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist. If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    www.dynamicsuser.net/.../14

    I will open this up to the community in case they have something to add.

    Thanks.

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    Have you checked in the failed e-mail in outbox queue to see if you can find any trace of your e-mail there?

  • Suggested answer
    YUN ZHU Profile Picture
    104,140 Super User 2026 Season 2 on at

    Hi, Sorry I haven't tried AzureAD app, but is there an alternative solution, using Job Queue to send emails periodically? For example, runs once every half a day, send if there is a record, skip if there is no record. That way, it should be the same as if you were executing from the action.

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Chameera Kavinda Profile Picture
    510 on at

    Hi,

    You can try to call your mail sending procedure using an API after populate the tables.

    Below will be helped.

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-creating-and-interacting-with-odatav4-unbound-action

    Thanks

    Chameera

  • AkaiRingo3559 Profile Picture
    on at

    Hi Chameera,

    Thanks for your reply. This is exactly what we're trying to do. Our application is making a call to the endpoint, the specified codeunit is running, we know this because all the other actions are completing. It's just the emailing that's not working.

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 633 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 419 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 236 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans