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

Changing logic on drop ship sales orders to support adjusting quantities

(0) ShareShare
ReportReport
Posted on by 206

Hi. The default behavior in Business Central is to prevent you changing an order quantity is a sales order is associated. This makes no sense. It should instead allow you to sychronise the quantity to the purchase order if no shipment has occurred yet. I have found a raised event that allows you to have some influence - but it is unclear to be if I need to recreate all the other validations that would occur in the regular code or else break the system by saying isHandled =  true.

My AL code is below:

[EventSubscriber(ObjectType::Table, Database::"Sales Line", 'OnBeforeCheckAssocPurchOrder', '', false, false)]
    local procedure HandleOnBeforeCheckAssocPurchOrder(TheFieldCaption: Text[250]; var IsHandled: Boolean; var SalesLine: Record "Sales Line"; xSalesLine: Record "Sales Line")
    var
        PurchaseLine: Record "Purchase Line";
        ContinueChangeQtyMsg: Label 'Do you want to change qty in associated PO?';
    begin
        If (SalesLine."Quantity (Base)" <> xSalesLine."Quantity (Base)") and (xSalesLine."Quantity (Base)" = xSalesLine."Outstanding Qty. (Base)") then begin
            PurchaseLine.SetRange("Document No.", SalesLine."Purchase Order No.");
            PurchaseLine.SetRange("Line No.", SalesLine."Purch. Order Line No.");
            PurchaseLine.SetRange("Document Type", PurchaseLine."Document Type"::Order);

            If PurchaseLine.FindFirst() and (PurchaseLine."Quantity (Base)" <> SalesLine."Quantity (Base)") then
                If Dialog.Confirm(ContinueChangeQtyMsg) then begin
                    PurchaseLine.validate(Quantity, SalesLine.Quantity);
                    PurchaseLine.Modify();
                    IsHandled := true;
                end;

            //TODO Determine if we actually need to recreate additional checks and code to duplicate other checks performed by this function
        end;

    end;
 

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Hello,

    If you think that this issue is caused by a bug, maybe you can file a support request to CSS and have us validate this in standard (assuming this is standard code).

    Thanks.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,821 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,122 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 959 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans