ShipIT 365
Adding Additional References to the transport order
The transport order contains several additional reference fields that are by default included in the API communication with the providers.
For instance, the Service Point (Ref) on the Transport Order is included in the API with the different providers.
However, in Business Central there is no business logic that populates the additional references by default.
The fields have to be populated by customizations.
This topic explains how an additional reference field can be populated.
*Not all reference fields are supported by all the providers
Another common question is how custom fields can be populated on the Transport Order (Header).
These new fields are typically populated with data from a certain source document or source document line.
When the additional references or custom fields are derived from a source document (line), like a sales order (line), then the OnBeforeFinalizeFrom* events in the IDYS Publisher codeunit (11147685) can be used.
(See a full list of those events further on in this topic).
These events have the source document (line) as a parameter and the transport worksheet line as a var parameter, so the field can be copied from the source document (line) to the transport worksheet line.
The additional references that exist on the transport order header, also exists as fields on the transport worksheet lines.
Populating the additional references on the transport worksheet line, will automatically populate the same field on the created transport order.
For custom fields on the transport order it is recommended to add the same field to the transport worksheet line table as well and then use the same events to populate them.
With the OnBeforeCreateTransportOrderLines event of the “IDYS Create Tpt. Ord. (Wrksh.)” codeunit the information can then be copied from the transport worksheet line to the transport order.
In the version 22.10.2398.0 3 new events have been introduced that make it easier to customize the transport order:
OnBeforeInsertTransportOrder
OnTransportOrderCreated
OnBeforeCreateTransportOrderLines
With the events listed below, the new field on the “IDYS Transport Worksheet Line” can then be populated with a value based on the Source Document or Source Document Line.
The following events exists:
procedure OnBeforeFinalizeFromSalesOrderLine(SalesLine: Record “Sales Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromSalesReturnOrderLine(SalesLine: Record “Sales Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromPurchaseReturnOrderLine(PurchaseLine: Record “Purchase Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromServiceOrderLine(ServiceLine: Record “Service Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromTransferOrderLine(TransferLine: Record “Transfer Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromWarehouseShipmentLine(WarehouseShipmentLine: Record “Warehouse Shipment Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromPostedSalesShipmentLine(SalesShipmentLine: Record “Sales Shipment Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromReturnShipmentLine(ReturnShipmentLine: Record “Return Shipment Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromServiceShipmentLine(ServiceShipmentLine: Record “Service Shipment Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromTransferShipmentLine(TransferShipmentLine: Record “Transfer Shipment Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
procedure OnBeforeFinalizeFromPostedReturnReceiptLine(ReturnReceiptLine: Record “Return Receipt Line”; var TransportWorksheetLine: Record “IDYS Transport Worksheet Line”)
If you create transport orders automatically during the posting of source documents, then you’ll need the events that are based on posted document lines.
If transport orders are manually manually from unposted documents, then the first set of events can be used.
When you are not relying on information from the source lines, then you can simply use the OnAfterInsert event of the “IDYS Transport Order Header” table or the OnBeforeCreateTransportOrder event of the IDYS Publisher codeunit.
IDYN 2024