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...
Answered

Block sales order creation

(1) ShareShare
ReportReport
Posted on by 107

Hi dears,

I know during creation of SO, when you enter an item quantity in Sales order line you get notification if that quantity is more than available quantity in the store, you can proceed but during posting you get stucked.

Now I was finding the way to block/stop the process when the quantity entered is bigger than available quantity, just when typing in quantity block process for that item

Thank you 

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    So you don't have any more questions for your case?

  • Suggested answer
    YUN ZHU Profile Picture
    104,090 Super User 2026 Season 2 on at

    Hi, as far as I know this needs to be customized and by default it won't block when you type the quantity.

    Hope this helps.

    Thanks.

    ZHU

  • Verified answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    You need to customize the solution like when you enter the Item on Sales Line, call a OnAfterValidate trigger of that Item and check if you have enough quantity available and then allow otherwise block with error.

    Thanks

    Nitin

  • Verified answer
    Mohana Yadav Profile Picture
    61,260 Super User 2026 Season 2 on at

    You can try with the below code but it will show error like below.

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Item-Check Avail.", 'OnBeforeCreateAndSendNotification', '', false, false)]
        local procedure OnBeforeCreateAndSendNotification(ItemNo: Code[20]; UnitOfMeasureCode: Code[20]; InventoryQty: Decimal; GrossReq: Decimal; ReservedReq: Decimal; SchedRcpt: Decimal; ReservedRcpt: Decimal; CurrentQuantity: Decimal; CurrentReservedQty: Decimal; TotalQuantity: Decimal; EarliestAvailDate: Date; RecordId: RecordId; LocationCode: Code[10]; ContextInfo: Dictionary of [Text, Text]; var Rollback: Boolean; var IsHandled: Boolean);
        var
            ItemCheckAvail: Codeunit "Item-Check Avail.";
            NotificationLifecycleMgt: Codeunit "Notification Lifecycle Mgt.";
            ItemAvailabilityCheck: Page "Item Availability Check";
            AvailabilityCheckNotification: Notification;
            NotificationMsg: Label 'The available inventory for item %1 is lower than the entered quantity at this location.', Comment = '%1=Item No.';
            DetailsTxt: Label 'Show details';
            DontShowAgainTxt: Label 'Don''t show again';
        begin
            AvailabilityCheckNotification.Id(CreateGuid());
            AvailabilityCheckNotification.Message(StrSubstNo(NotificationMsg, ItemNo));
            AvailabilityCheckNotification.Scope(NOTIFICATIONSCOPE::LocalScope);
            AvailabilityCheckNotification.AddAction(DetailsTxt, CODEUNIT::"Item-Check Avail.", 'ShowNotificationDetails');
            AvailabilityCheckNotification.AddAction(DontShowAgainTxt, CODEUNIT::"Item-Check Avail.", 'DeactivateNotification');
            ItemAvailabilityCheck.PopulateDataOnNotification(AvailabilityCheckNotification, ItemNo, UnitOfMeasureCode,
              InventoryQty, GrossReq, ReservedReq, SchedRcpt, ReservedRcpt, CurrentQuantity, CurrentReservedQty,
              TotalQuantity, EarliestAvailDate, LocationCode);
            NotificationLifecycleMgt.SendNotificationWithAdditionalContext(
              AvailabilityCheckNotification, RecordId, ItemCheckAvail.GetItemAvailabilityNotificationId());
            Rollback := true;
            IsHandled := true;
        end;

    pastedimage1673584336648v1.png

  • Maro9595 Profile Picture
    107 on at

    Thank you,

    Correct

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 665 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 418 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 280 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans