Skip to main content

Notifications

Announcements

No record found.

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 397 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

  • T_Mauser Profile Picture
    397 User Group Leader on at
    RE: How to change table data after Email was sent successfully?

    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.

  • Suggested answer
    Andy Sather Profile Picture
    on at
    RE: How to change table data after Email was sent successfully?

    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.

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans