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

which event or suscription must to modify "Posting No Series Code" field, in Sales header

(0) ShareShare
ReportReport
Posted on by 108

Hi

I have two serial numbers (in No Series Relation ship)) to post my sales order (in setup posting invoice No), and I have the function that defines which series should be assigned for the order to be posted,
the question is which event or on which subscription should I call the procedure I create?

I am using an extention for Sales order card and put the procedure in the trigger modify Like this:

trigger OnModifyRecord()Boolean
    begin
        Rec."Posting No. Series" := DCLFunSalesCode.TypePosting(Rec."Sell-to Customer No.");
    end;
But I am not sure if I must to use in my codeunit somethig like. 

    [EventSubscriber(ObjectType::Tabledatabase::"Sales Header", 'OnAfterGetPostingNoSeriesCode''', false, false)]
    local procedure OnAfterGetPostingNoSeriesCode(SalesHeader: Record "Sales Header"; var PostingNos: Code[20])
    begin
        if SalesHeader."Sell-to Customer No." <> '' then
            SalesHeader."Posting No. Series" := TypePosting(SalesHeader."Sell-to Customer No.");
    end;
the problem is I can't see when is execute for this suscriber and with the trigger modify is calling when I close de page, and I need to be 
sure that the my procedure is executed before to be posted.
I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,278 Super User 2026 Season 1 on at

    You can subscribe to the OnAfterInitRecord event in the table 36, where you can override posting no. series.

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