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

Block sales order creation

(1) ShareShare
ReportReport
Posted on by 105

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 

I have the same question (0)
  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,071 Moderator on at
    RE: Block sales order creation

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

  • Suggested answer
    YUN ZHU Profile Picture
    94,070 Super User 2025 Season 2 on at
    RE: Block sales order creation

    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,698 Moderator on at
    RE: Block sales order creation

    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
    60,979 Super User 2025 Season 2 on at
    RE: Block sales order creation

    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
    105 on at
    RE: Block sales order creation

    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

Responsible AI policies

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

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,351

#2
Sumit Singh Profile Picture

Sumit Singh 2,072

#3
YUN ZHU Profile Picture

YUN ZHU 1,807 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans