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

How to change table data after Email was sent successfully?

(0) ShareShare
ReportReport
Posted on by 401 User Group Leader

Hi, I am trying to extend a normal workflow with an EventSubscriper to change a specific Enum in the Sales Header of a Quote.

For that I created a codeunit - look at the code:

codeunit 50144 StatusInternCodeunit


{
    Permissions = tabledata "Sales Header" = RIMD;
    Access = Public;
    trigger OnRun()
    begin

    end;

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Document-Mailing", 'OnAfterEmailSentSuccesfully', '', false, false)]

    local procedure OnAfterSendMailAddVersendet()
    var
        SalesHeader: Record "Sales Header";
        StatusEnum: Enum StatusSalesQuoteEnum;
        SalesEnum: Enum "Sales Document Type";
    begin
        if (SalesHeader."Document Type"::Quote = SalesEnum::Quote) then begin
            SalesHeader.Validate("Status Intern", StatusEnum::Versendet);
            SalesHeader.MODIFY;
        end;
    end;

    var

}


//Missing the correct quote...

After the codeunit runs nothing changed so I have issues with getting the data/enum changed...

First, when calling "Send by Mail":

pastedimage1645802518597v2.png

Second when MODIFY() is called:

pastedimage1645802584077v3.png

pastedimage1645802607175v4.png

English: 

'Sales header' does not exist. Identifying fields and values: Document Type='Offer',No.=''

I think, it has issues with getting the right quote to change the right value, but how can I get the right/actual quote to change the table data?

Thank you guys, I am currently learning AL Programming and try to get better everyday.

Tom

I have the same question (0)
  • Suggested answer
    Andy Sather 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

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

  • T_Mauser Profile Picture
    401 User Group Leader on at

    Hmm I cannot find the group on yammer or the link isn't working (Error 404)

    Would be great if you can share the information!

    Thank you.

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,216 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,471 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,369

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans