Use this event to
Validate untransferred License Plates prior to posting
Description
Use this event to validate untransferred License Plates (transaction data) stored in internal "Pack and Ship" tables prior to creating data in 3rd party Shipping App.
See also: Read master data from 3rd party Shipping App
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOS Pack API", 'OnBeforePostPacking', '', true, true)]
local procedure OnBeforePostPacking_UpdatePackingStation(_RegistrationType: Text; _PackingStation: Record "MOS Packing Station"; var _RequestValues: Record "MOB NS Request Element")
begin
if _RegistrationType <> 'PostPacking' then
exit;
// Your custom code here...
end;
Example
/// TODO
Version History
Version | Changes |
---|---|
MOS1.0.0 | Introduced |
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOS Pack API", 'OnPostPackingOnCheckUntransferredLicensePlate', '', true, true)]
local procedure OnPostPackingOnCheckUntransferredLicensePlate(_LicensePlate: Record "MOS License Plate")
var
IdysSetup: Record "IDYS Setup";
IdysPackageType: Record "IDYS Package Type";
PackageType: Record "MOS Package Type";
begin
if not IsShippingProvider(_LicensePlate."Package Type") then
exit;
// Check PackageType exists and will not error out during validation
PackageType.Get(_LicensePlate."Package Type");
IdysPackageType.Get(PackageType."Shipping Provider Package Type");
// Check we are indeed supposed to create Transport Order from our code
IdysSetup.Get();
IdysSetup.TestField("After Posting Sales Orders", IdysSetup."After Posting Sales Orders"::"Do nothing"); // TODO - baseres på LicensePlate.Source Type og/eller Whse. Document Type
end;