Use this event to
Synchronize master data for Package Types from 3rd party Shipping App to Tasklet Pack and Ship
Description
Package Types including their default Dimensions and Unit of Measures.
Imported Package Types will be available in Pack & Ship setup tables and in that way can be exposed on mobile devices.
See: Read master data from 3rd party Shipping App
Template
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Pack API", 'OnSynchronizePackageTypes', '', false, false)]
local procedure OnSynchronizePackageTypes(var _PackageType: Record "MOB Package Type");
begin
end;
Example
/// <summary>
/// Interface implementation: Synchronize package types from external solution to our own internal table
/// </summary>
[EventSubscriber(ObjectType::Codeunit, Codeunit::"MOS Pack API", 'OnSynchronizePackageTypes', '', true, true)]
local procedure OnSynchronizePackageTypes(var _PackageType: Record "MOS Package Type")
begin
SynchronizePackageTypes(_PackageType);
end;
internal procedure SynchronizePackageTypes(var _PackageType: Record "MOS Package Type")
var
IdysPackageType: Record "IDYS Package Type";
begin
IdysPackageType.Reset();
if IdysPackageType.FindSet() then
repeat
_PackageType.Init();
_PackageType.Validate(Code, '');
_PackageType.Validate("Shipping Provider Id", GetShippingProviderId());
_PackageType.Validate("Shipping Provider Package Type", IdysPackageType.Code);
_PackageType.Validate(Description, CopyStr(IdysPackageType.Description, 1, MaxStrLen(_PackageType.Description)));
_PackageType.Validate(Default, IdysPackageType.Default);
_PackageType.Validate(Unit, IdysPackageType.Type);
_PackageType.Validate(Height, IdysPackageType.Height);
_PackageType.Validate(Width, IdysPackageType.Width);
_PackageType.Validate(Length, IdysPackageType.Length);
_PackageType.Validate(Weight, IdysPackageType.Weight);
if _PackageType.Insert(true) then; // Package Type may already exist
until IdysPackageType.Next() = 0;
end;
Version History
Version | Changes |
---|---|
MOS1.0.0 | Introduced |