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

How to call "Create Warehouseshipment" twice

(0) ShareShare
ReportReport
Posted on by 450

On the Sales Order page there is an action called "Create Warehouse shipment". Now i was wondering if what way i would be able to call that action twice in code, so basically when i click the action, it performs the cycle twice.

Any help would be welcome.

  • Suggested answer
    Avinash B Profile Picture
    1,455 on at

    Hi

    Firstly I would like to know why you want to create the Warehouse shipment twice?

    And if you want to do so, you can use the "OnAfterActionEvent" of "Create Warehouse Shipment" action and copy the same piece of code.

    Regards

    Avinash B

  • InsertX Profile Picture
    450 on at

    normally it would take the amount that you fill in on your sales line to you warehouse shipment line. now i've added fields and depending on what value is filled in on those it might not have to take the amount of the sales line but it would have to created a warehouse shipment, 1 for the value filled in in the first field i've added and the second warehouse shipment would be for the value i filled in on the second field i've added.

    But on another not about what you said,

    this is the code i have at the moment for what i want:

    modify("Create &Warehouse Shipment")
    {     
         trigger OnAfterAction()
         begin
                    
         end;
    }
    but "the piece of code" as you refered to i wouldn't know what code you mean by that.
  • Suggested answer
    Avinash B Profile Picture
    1,455 on at

    Hi

    modify("Create &Warehouse Shipment")
    {     
         trigger OnAfterAction()
         begin
                    
         end;
    }
    

    The piece of code you have shared is one of the ways of solving your problem. What I mean in my previous post was by creating a subscriber codeunit like below.

    codeunit 50100 "Event Subscriber"
    {
        EventSubscriberInstance = StaticAutomatic;
        trigger OnRun()
        begin
    
        end;
    
        [EventSubscriber(ObjectType::Page, Page::"Sales Order", 'OnAfterActionEvent', 'Create &Warehouse Shipment', true, true)]
        local procedure OnAfterActionEvent_CreateWarehouseShipment(var Rec: Record "Sales Header")
        begin
            // Build your logic here
        end;
    
        var
            myInt: Integer;
    }

    And also as for my understanding of the requirement, you need to change the amount also while creating the Shipment. For that also you can create an event subscriber like above and change your amount in the shipment.

    Regards

    Avinash B

  • InsertX Profile Picture
    450 on at

    Hi again,

    I see what you're saying and indeed both would be working but this still leaves me to the problem that i'm unable to find how to trigger the 'Create warehouse shipment' action again. I've tried it by trying to make a variable of type Page "Sales Order" but that doesn't seem to be possible since i'm only able to find "Sales Orders" note the extra s at the end.

    So i must be forgetting something or just not fully understanding it.

    Regards,

    InsertX

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

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 741 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 514 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 336 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans