Page 6292 Sust. ESG Fact List
src/Apps/W1/Sustainability/app/src/CRM/SustESGFactList.Page.al184 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.Sustainability.CRM;using Microsoft.Integration.Dataverse;using Microsoft.Sustainability.ESGReporting;page 6292 "Sust. ESG Fact List"{ ApplicationArea = Suite; Caption = 'ESG Fact - Dataverse'; Editable = false; PageType = List; SourceTable = "Sust. ESG Fact"; SourceTableView = sorting(Name); UsageCategory = Lists; layout { area(content) { repeater(Control2) { ShowCaption = false; field(Name; Rec.Name) { ApplicationArea = Suite; Caption = 'Name'; StyleExpr = FirstColumnStyle; ToolTip = 'Specifies data from a corresponding field in a Dataverse entity. For more information about Dataverse, see Dataverse Help Center.'; } field(ConceptName; Rec.ConceptName) { ApplicationArea = Suite; Caption = 'Concept'; ToolTip = 'Specifies data from a corresponding field in a Dataverse entity. For more information about Dataverse, see Dataverse Help Center.'; } field(FactStatus; Rec.FactStatus) { ApplicationArea = Suite; Caption = 'Fact Status'; ToolTip = 'Specifies data from a corresponding field in a Dataverse entity. For more information about Dataverse, see Dataverse Help Center.'; } field(PeriodName; Rec.PeriodName) { ApplicationArea = Suite; Caption = 'Period'; ToolTip = 'Specifies data from a corresponding field in a Dataverse entity. For more information about Dataverse, see Dataverse Help Center.'; } field(NumericValue; Rec.NumericValue) { ApplicationArea = Suite; Caption = 'Posted Amount'; ToolTip = 'Specifies data from a corresponding field in a Dataverse entity. For more information about Dataverse, see Dataverse Help Center.'; } field(Precision; Rec.Precision) { ApplicationArea = Suite; Caption = 'Precision'; ToolTip = 'Specifies data from a corresponding field in a Dataverse entity. For more information about Dataverse, see Dataverse Help Center.'; } field(UnitName; Rec.UnitName) { ApplicationArea = Suite; Caption = 'Unit'; ToolTip = 'Specifies data from a corresponding field in a Dataverse entity. For more information about Dataverse, see Dataverse Help Center.'; } field(Coupled; Coupled) { ApplicationArea = Suite; Caption = 'Coupled'; ToolTip = 'Specifies if the Dataverse record is coupled to Business Central.'; } } } } actions { area(processing) { action(ShowOnlyUncoupled) { ApplicationArea = Suite; Caption = 'Hide Coupled Facts'; Image = FilterLines; ToolTip = 'Do not show coupled facts.'; trigger OnAction() begin Rec.MarkedOnly(true); end; } action(ShowAll) { ApplicationArea = Suite; Caption = 'Show Coupled Facts'; Image = ClearFilter; ToolTip = 'Show coupled facts.'; trigger OnAction() begin Rec.MarkedOnly(false); end; } } area(Promoted) { group(Category_Process) { Caption = 'Process'; actionref(ShowOnlyUncoupled_Promoted; ShowOnlyUncoupled) { } actionref(ShowAll_Promoted; ShowAll) { } } } } trigger OnInit() begin Codeunit.Run(Codeunit::"CRM Integration Management"); Commit(); end; trigger OnOpenPage() var LookupCRMTables: Codeunit "Lookup CRM Tables"; begin Rec.FilterGroup(4); Rec.SetView(LookupCRMTables.GetIntegrationTableMappingView(Database::"Sust. ESG Fact")); Rec.FilterGroup(0); end; trigger OnAfterGetRecord() begin SetControlAppearance(); end; var CurrentlyCoupledCRMFact: Record "Sust. ESG Fact"; Coupled: Text; FirstColumnStyle: Text; CurrentLbl: Label 'Current'; StrongLbl: Label 'Strong'; NoLbl: Label 'No'; YesLbl: Label 'Yes'; NoneLbl: Label 'None'; SubordinateLbl: Label 'Subordinate'; local procedure SetControlAppearance() var CRMIntegrationRecord: Record "CRM Integration Record"; RecordID: RecordID; EmptyRecordID: RecordID; begin if CRMIntegrationRecord.FindRecordIDFromID(Rec.ESGFactId, Database::"Sust. Posted ESG Report Line", RecordID) then if CurrentlyCoupledCRMFact.ESGFactId = Rec.ESGFactId then begin Coupled := CurrentLbl; FirstColumnStyle := StrongLbl; Rec.Mark(true); end else begin Coupled := YesLbl; FirstColumnStyle := SubordinateLbl; Rec.Mark(false); end; if RecordID = EmptyRecordID then begin Coupled := NoLbl; FirstColumnStyle := NoneLbl; Rec.Mark(true); end; end; procedure SetCurrentlyCoupledCRMFact(CRMFact: Record "Sust. ESG Fact") begin CurrentlyCoupledCRMFact := CRMFact; end;}