Skip to main content
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 106

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.
  • Suggested answer
    Suresh Kulla Profile Picture
    47,791 on at
    RE: which event or suscription must to modify "Posting No Series Code" field, in Sales header

    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

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