Page 11 Shipment Methods

Base Application, Microsoft.Foundation.Shipping

src/Layers/W1/BaseApp/Foundation/Shipping/ShipmentMethods.Page.al237 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License. See License.txt in the project root for license information.// ------------------------------------------------------------------------------------------------namespace Microsoft.Foundation.Shipping;using Microsoft.Integration.Dataverse;page 11 "Shipment Methods"{    ApplicationArea = Basic, Suite;    Caption = 'Shipment Methods';    PageType = List;    SourceTable = "Shipment Method";    UsageCategory = Administration;    layout    {        area(content)        {            repeater(Control1)            {                ShowCaption = false;                field("Code"; Rec.Code)                {                    ApplicationArea = Basic, Suite;                }                field(Description; Rec.Description)                {                    ApplicationArea = Basic, Suite;                }                field("Coupled to Dataverse"; CDSIsCoupledToRecord)                {                    ApplicationArea = All;                    Caption = 'Coupled to Dataverse';                    ToolTip = 'Specifies that the shipment method is coupled to a freight term in Dataverse.';                    Visible = CDSIntegrationEnabled;                    Editable = false;                }            }        }        area(factboxes)        {            systempart(Control1900383207; Links)            {                ApplicationArea = RecordLinks;                Visible = false;            }            systempart(Control1905767507; Notes)            {                ApplicationArea = Notes;                Visible = false;            }        }    }    actions    {        area(processing)        {            action("T&ranslation")            {                ApplicationArea = Basic, Suite;                Caption = 'T&ranslation';                Image = Translation;                RunObject = Page "Shipment Method Translations";                RunPageLink = "Shipment Method" = field(Code);                ToolTip = 'Describe the shipment method in different languages. The translated descriptions appear on quotes, orders, invoices, and credit memos, based on the shipment method code and the language code on the document.';            }            group(ActionGroupCRM)            {                Caption = 'Dataverse';                Image = Administration;                Visible = CDSIntegrationEnabled;                action(CRMSynchronizeNow)                {                    AccessByPermission = TableData "CRM Integration Record" = IM;                    ApplicationArea = Suite;                    Caption = 'Synchronize';                    Image = Refresh;                    ToolTip = 'Send or get updated data to or from Dataverse.';                    trigger OnAction()                    var                        ShipmentMethod: Record "Shipment Method";                        CRMIntegrationManagement: Codeunit "CRM Integration Management";                        ShipmentMethodRecordRef: RecordRef;                    begin                        CurrPage.SetSelectionFilter(ShipmentMethod);                        ShipmentMethodRecordRef.GetTable(ShipmentMethod);                        CRMIntegrationManagement.UpdateMultipleNow(ShipmentMethodRecordRef, true);                    end;                }                group(Coupling)                {                    Caption = 'Coupling', Comment = 'Coupling is a noun';                    Image = LinkAccount;                    ToolTip = 'Create, change, or delete a coupling between the Business Central record and a Dataverse record.';                    action(ManageCRMCoupling)                    {                        AccessByPermission = TableData "CRM Integration Record" = IM;                        ApplicationArea = Suite;                        Caption = 'Set Up Coupling';                        Image = LinkAccount;                        ToolTip = 'Create or modify the coupling to a Dataverse Freight Term.';                        trigger OnAction()                        var                            CRMIntegrationManagement: Codeunit "CRM Integration Management";                        begin                            CRMIntegrationManagement.DefineOptionMapping(Rec.RecordId);                        end;                    }                    action(MatchBasedCoupling)                    {                        AccessByPermission = TableData "CRM Integration Record" = IM;                        ApplicationArea = Suite;                        Caption = 'Match-Based Coupling';                        Image = CoupledUnitOfMeasure;                        ToolTip = 'Couple shipment methods in Dataverse based on criteria.';                        trigger OnAction()                        var                            ShipmentMethod: Record "Shipment Method";                            CRMIntegrationManagement: Codeunit "CRM Integration Management";                            RecRef: RecordRef;                        begin                            CurrPage.SetSelectionFilter(ShipmentMethod);                            RecRef.GetTable(ShipmentMethod);                            CRMIntegrationManagement.MatchBasedCoupling(RecRef);                        end;                    }                    action(DeleteCRMCoupling)                    {                        AccessByPermission = TableData "CRM Integration Record" = D;                        ApplicationArea = Suite;                        Caption = 'Delete Coupling';                        Enabled = CDSIsCoupledToRecord;                        Image = UnLinkAccount;                        ToolTip = 'Delete the coupling to a Dataverse Freight Term.';                        trigger OnAction()                        var                            ShipmentMethod: Record "Shipment Method";                            CRMIntegrationManagement: Codeunit "CRM Integration Management";                            RecRef: RecordRef;                        begin                            CurrPage.SetSelectionFilter(ShipmentMethod);                            RecRef.GetTable(ShipmentMethod);                            CRMIntegrationManagement.RemoveOptionMapping(RecRef);                        end;                    }                }                action(ShowLog)                {                    ApplicationArea = Suite;                    Caption = 'Synchronization Log';                    Image = Log;                    ToolTip = 'View integration synchronization jobs for the shipment method table.';                    trigger OnAction()                    var                        CRMIntegrationManagement: Codeunit "CRM Integration Management";                    begin                        CRMIntegrationManagement.ShowOptionLog(Rec.RecordId);                    end;                }            }        }        area(Promoted)        {            group(Category_Process)            {                Caption = 'Process', Comment = 'Generated from the PromotedActionCategories property index 1.';            }            group(Category_Shipment_Method)            {                Caption = 'Shipment Method';                actionref("T&ranslation_Promoted"; "T&ranslation")                {                }            }            group(Category_Synchronize)            {                Caption = 'Synchronize';                Visible = CDSIntegrationEnabled;                group(Category_Coupling)                {                    Caption = 'Coupling';                    ShowAs = SplitButton;                    actionref(ManageCRMCoupling_Promoted; ManageCRMCoupling)                    {                    }                    actionref(DeleteCRMCoupling_Promoted; DeleteCRMCoupling)                    {                    }                    actionref(MatchBasedCoupling_Promoted; MatchBasedCoupling)                    {                    }                }                actionref(ShowLog_Promoted; ShowLog)                {                }                actionref(CRMSynchronizeNow_Promoted; CRMSynchronizeNow)                {                }            }        }    }    trigger OnAfterGetRecord()    var        CRMOptionMapping: Record "CRM Option Mapping";    begin        CDSIsCoupledToRecord := CDSIntegrationEnabled;        if CDSIsCoupledToRecord then begin            CRMOptionMapping.SetRange("Record ID", Rec.RecordId);            CDSIsCoupledToRecord := not CRMOptionMapping.IsEmpty();        end;    end;    trigger OnOpenPage()    var        CRMIntegrationManagement: Codeunit "CRM Integration Management";    begin        CDSIntegrationEnabled := CRMIntegrationManagement.IsCDSIntegrationEnabled();    end;    var        CDSIntegrationEnabled: Boolean;        CDSIsCoupledToRecord: Boolean;}