OnPostShipOrder_OnBeforeRunWhsePostShipment
Use this event to
Code to be executed prior to posting via standard posting routines.
Description
The event can be used to call functions on the standard posting codeunit before run. For Instance, activate printing document on posting or change filtering on lines before posting.
Commit
Database transactions in [...]OnBeforeRunWhsePostShipment is committed to the database prior to calling the standard "Whse.-Post Shipment" function. Your customized code must be structured accordingly.
You may subscribe to standard posting events to ensure the rollback of your database transactions or trigger events on-after posting if this is required for your code.
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Ship", 'OnPostShipOrder_OnBeforeRunWhsePostShipment', '', true, true)]
local procedure MyOnPostShipOrder_OnBeforeRunWhsePostShipment(var _WhseShipmentLinesToPost: Record "Warehouse Shipment Line"; var _WhsePostShipment: Codeunit "Whse.-Post Shipment")
begin
end;
See also:
How-to: Subscribing to standard events
Example
// [Example]: Print Document on Posting
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Ship", 'OnPostShipOrder_OnBeforeRunWhsePostShipment', '', true, true)]
local procedure My01OnPostShipOrder_OnBeforeRunWhsePostShipment(var _WhseShipmentLinesToPost: Record "Warehouse Shipment Line"; var _WhsePostShipment: Codeunit "Whse.-Post Shipment")
begin
_WhsePostShipment.SetPrint(true);
end;
// [Example]: Invoice Document on Posting
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB WMS Ship", 'OnPostShipOrder_OnBeforeRunWhsePostShipment', '', true, true)]
local procedure My02OnPostShipOrder_OnBeforeRunWhsePostShipment(var _WhseShipmentLinesToPost: Record "Warehouse Shipment Line"; var _WhsePostShipment: Codeunit "Whse.-Post Shipment")
begin
_WhsePostShipment.SetPostingSettings(true); // Parameter is "PostInvoice"
end;
Version History
Version | Changes |
---|---|
MOB5.14 | Introduced |