Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Use this event to

...

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", 'OnSynchronizePackageTypesOnDiscoverShippingProvider', '', falsetrue, falsetrue)]
    localprocedure OnSynchronizePackageTypes(var _PackageType: Record"MOB Package Type");
begin
OnDiscoverShippingProvider()
    begin
    end;


Example

    /// <summary>
    /// Interface implementation: Synchronize package types from external solution to our own internal table
    /// </summary>  
    [EventSubscriber(ObjectType::Codeunit, Codeunit::"MOB Pack API", 'OnSynchronizePackageTypes', '', true, true)]
    localprocedure MyOnSynchronizePackageTypes(var _PackageType: Record"MOB Package Type")
    begin
        SynchronizePackageTypes(_PackageType);
    end;

    
    internalprocedure SynchronizePackageTypes(var _PackageType: Record"MOB Package Type")
    var
        ExternalPackageType: Record"External Package Type";    // Package Type table in 3rd Party App
    begin
        ExternalPackageType.Reset();
        if ExternalPackageType.FindSet() then
            repeat
                _PackageType.Init();
                _PackageType.Validate(Code, '');
                _PackageType.Validate("Shipping Provider Id", GetShippingProviderId());
                _PackageType.Validate("Shipping Provider Package Type", ExternalPackageType.Code);
                _PackageType.Validate(Description, CopyStr(ExternalPackageType.Description, 1, MaxStrLen(_PackageType.Description)));
                _PackageType.Validate(Default, ExternalPackageType.Default);
                _PackageType.Validate(Unit, ExternalPackageType.Type);
                _PackageType.Validate(Height, ExternalPackageType.Height);
                _PackageType.Validate(Width, ExternalPackageType.Width);
                _PackageType.Validate(Length, ExternalPackageType.Length);
                _PackageType.Validate(Weight, ExternalPackageType.Weight);
                if _PackageType.Insert(true) then;  // Package Type may already exist                
            until ExternalPackageType.Next() = 0;
    end;

    localprocedure GetShippingProviderId(): Code[20]
    begin
        exit('MYSHIPPINGPROVIDERID');
    end;

Version History

VersionChanges
MOB5.42Introduced

...