web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Sales Order Posting

(3) ShareShare
ReportReport
Posted on by 112
Hi Experts,
 
Hope everyone doing fine.
 
I am trying to post a sales order from a job queue in background. Today , I came across a error which is The binding of codeunit 80 was unsuccessful. The codeunit has already been bound. This issue is coming in ProcessPostingLines function in codeunit 80 (Sales-Post). If I try to post same sales order., issue does not comes up only from Job queue. One more thing before I post from code ,  I am doing commit otherwise issue comes for contact for microsoft administrator.
 
If anyone have idea about this , Please help. Thanks in Advance..🙏🙏
 
I am putting callstack here.
and you can find the issue on line which I highlighed here in standard code below.
 
local procedure ProcessPostingLines(var SalesHeader: Record "Sales Header"; var SalesHeader2: Record "Sales Header";
                                   var TempDropShptPostBuffer: Record "Drop Shpt. Post. Buffer" temporary;
                                   var CustLedgEntry: Record "Cust. Ledger Entry";
                                   var EverythingInvoiced: Boolean)
    var
       ...
    begin
        InvoicePostingInterface.ClearBuffers();
 
        TempDropShptPostBuffer.DeleteAll();
        EverythingInvoiced := true;
 
        // Lines
        GetZeroSalesLineRecID(SalesHeader, ZeroSalesLineRecID);
        ErrorMessageMgt.PushContext(ErrorContextElementProcessLines, ZeroSalesLineRecID, 0, PostDocumentLinesMsg);
        OnBeforePostLines(TempSalesLineGlobal, SalesHeader, SuppressCommit, PreviewMode, TempWhseShptHeader, ItemJnlPostLine);
 
        LineCount := 0;
        RoundingLineInserted := false;
        AdjustFinalInvWith100PctPrepmt(TempSalesLineGlobal);
 
        TempVATAmountLineRemainder.DeleteAll();
        IsHandled := false;
        OnRunOnBeforeCalcVATAmountLines(TempSalesLineGlobal, SalesHeader, TempVATAmountLine, IsHandled);
        if not IsHandled then
            TempSalesLineGlobal.CalcVATAmountLines(1, SalesHeader, TempSalesLineGlobal, TempVATAmountLine);
 
        OnBeforePostSalesLines(SalesHeader, TempSalesLineGlobal, TempVATAmountLine, EverythingInvoiced);
 
        Clear(PostponedValueEntries);
        BindSubscription(this); // Start collect value entries for GLPosting
 
        SalesLinesProcessed := false;
        if TempSalesLineGlobal.FindSet() then
            repeat
 
I have the same question (0)
  • Verified answer
    Montassar Krichi Profile Picture
    231 on at
    Sales Order Posting
    Hi,
    The error is raised from this line:
    BindSubscription(this); // Start collect value entries for GLPosting


    🔹 1. Never reuse posting codeunit instances
    Ensure that each Sales Order posting in background uses a new instance of Codeunit 80, especially when triggered inside a loop or a long-running job queue.
    🔹 2. Use COMMIT wisely before/after posting
    As you mentioned, doing a COMMIT before calling the posting logic helps avoid “contact Microsoft administrator” issues. That’s good, but avoid too many commits—especially inside Codeunit 80.
    🔹 3. Avoid calling BindSubscription() more than once
    This is more for Microsoft’s internals, but if you are customizing Codeunit 80, ensure you're not accidentally calling BindSubscription(this) multiple times (e.g., if you re-trigger ProcessPostingLines()).
     
  • Suggested answer
    YUN ZHU Profile Picture
    92,576 Super User 2025 Season 2 on at
    Sales Order Posting
    Hi, Please do not use 80 directly, use 296 Batch Post Sales Orders recommended by Microsoft
     
    Hope this helps.
    Thanks.
    ZHU
  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,199 Super User 2025 Season 2 on at
    Sales Order Posting
    Is this OnPrem?
     
    I don't see the same code as you do.
     
  • Unanonyms.5974 Profile Picture
    112 on at
    Sales Order Posting
    Thanks @Monstassar Krichi,
     
    I checked , I was using same instance of codeunit in multiple runs in Loop . Very thanks for your such valuable input.
     
    Now , it is working fine . Thanks
     
    @Yun Zhu, Also very thanks for you valuable input , I will look into these report , If we will automate posting in BC. Thanks.
  • Unanonyms.5974 Profile Picture
    112 on at
    Sales Order Posting
    Hi Teddy , 
     
    It is Saas Environment.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    19,137 Super User 2025 Season 2 on at
    Sales Order Posting
  • Gerardo Rentería García Profile Picture
    23,574 Most Valuable Professional on at
    Sales Order Posting

    Hi, good day
    I hope this can help you, and give you some hints.

    Solved: Job Queue to schedule task for Sales order post

    Post Multiple Documents at the Same Time - Business Central | Microsoft Learn

    Best Regards
    Gerardo

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,160

#2
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,943

#3
Sumit Singh Profile Picture

Sumit Singh 2,823

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans