Skip to content

Commit 80a0efb

Browse files
mynjjJoshua Martínez PinedaclaudeCopilot
authored
Uptaking the refactored Power BI synch engine for the OOB apps (#6763)
#### Summary - Introduce the `PBI Report Setup` enum and interface to represent Power BI report app configurations, replacing raw field IDs with strongly-typed enum values - Refactor all embedded report pages (~120) to use the new `OpenPowerBIEmbeddedReportPageValidation` procedure, which consolidates `EnsureUserAcceptedPowerBITerms` + `GetReportIdAndEnsureSetup` + deployment-in-progress prompts into a single call - Adds a new wizard experience for deploying reports when selecting an unconfigured embedded report page (for evaluation companies) - Add `FindReportSetup` to resolve a `Deployable Report` type back to its `PBI Report Setup` interface, eliminating repeated ordinal iteration in subscribers and the deployments page extension - Fix a pre-existing bug where the ABC Analysis page (Inventory) was incorrectly referencing the Sales report ID #### Work Item(s) Fixes [AB#600448](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/600448) --------- Co-authored-by: Joshua Martínez Pineda <diegojoshuam@microsoft.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
1 parent bb4aa5e commit 80a0efb

367 files changed

Lines changed: 941 additions & 108215 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Apps/W1/PowerBIReports/Power BI Files/Finance app/Finance app.pbix renamed to src/Apps/W1/PowerBIReports/App/.resources/Finance app.pbix

File renamed without changes.

src/Apps/W1/PowerBIReports/Power BI Files/Inventory Valuation app/Inventory Valuation app.pbix renamed to src/Apps/W1/PowerBIReports/App/.resources/Inventory Valuation app.pbix

File renamed without changes.

src/Apps/W1/PowerBIReports/Power BI Files/Inventory app/Inventory app.pbix renamed to src/Apps/W1/PowerBIReports/App/.resources/Inventory app.pbix

File renamed without changes.

src/Apps/W1/PowerBIReports/Power BI Files/Manufacturing app/Manufacturing app.pbix renamed to src/Apps/W1/PowerBIReports/App/.resources/Manufacturing app.pbix

File renamed without changes.

src/Apps/W1/PowerBIReports/Power BI Files/Projects app/Projects app.pbix renamed to src/Apps/W1/PowerBIReports/App/.resources/Projects app.pbix

File renamed without changes.

src/Apps/W1/PowerBIReports/Power BI Files/Purchase app/Purchase app.pbix renamed to src/Apps/W1/PowerBIReports/App/.resources/Purchase app.pbix

File renamed without changes.

src/Apps/W1/PowerBIReports/Power BI Files/Sales app/Sales app.pbix renamed to src/Apps/W1/PowerBIReports/App/.resources/Sales app.pbix

File renamed without changes.

src/Apps/W1/PowerBIReports/Power BI Files/Sustainability app/Sustainability app.pbix renamed to src/Apps/W1/PowerBIReports/App/.resources/Sustainability app.pbix

File renamed without changes.

src/Apps/W1/PowerBIReports/App/Core/Codeunits/Initialization.Codeunit.al

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ codeunit 36951 Initialization
2525
DimensionSetEntriesJobQueueDescriptionLbl: Label 'Update Power BI Dimension Set Entries';
2626

2727
procedure SetupDefaultsForPowerBIReportsIfNotInitialized()
28+
var
29+
PBISetup: Record "PowerBI Reports Setup";
2830
begin
2931
InsertGuidedExperience();
30-
InitializePBISetup();
32+
PBISetup.GetOrCreate();
3133
InitializePBIWorkingDays();
3234
InitializeStartingEndingDates();
3335
InitializeDimensionSetEntryCollectionJobQueueEntry();
@@ -59,16 +61,6 @@ codeunit 36951 Initialization
5961
FinanceInstallationHandler.SetupDefaultsForPowerBIReportsIfNotInitialized();
6062
end;
6163

62-
local procedure InitializePBISetup()
63-
var
64-
PBISetup: Record "PowerBI Reports Setup";
65-
begin
66-
if not PBISetup.Get() then begin
67-
PBISetup.Init();
68-
PBISetup.Insert();
69-
end;
70-
end;
71-
7264
local procedure InitializeStartingEndingDates()
7365
var
7466
AccountingPeriod: Record "Accounting Period";

src/Apps/W1/PowerBIReports/App/Core/Codeunits/PowerBIReportSetup.Codeunit.al

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace Microsoft.PowerBIReports;
77
using System.Environment.Configuration;
88
using System.Globalization;
99
using System.Integration.PowerBI;
10+
using System.Utilities;
1011

1112
codeunit 36962 "Power BI Report Setup"
1213
{
@@ -26,6 +27,47 @@ codeunit 36962 "Power BI Report Setup"
2627
end;
2728
end;
2829

30+
/// <summary>
31+
/// Ensures that everything related to the specified Power BI report setup is properly configured, or directs to the appropriate setup pages. It errors if after the different prompts the report is not set up or in the process of being deployed. Typically used as a validation step before opening an embedded Power BI report page.
32+
/// </summary>
33+
/// <param name="PBIReportSetup">The Power BI report setup to validate.</param>
34+
/// <returns>The GUID of the Power BI report as configured in the setup.</returns>
35+
procedure OpenPowerBIEmbeddedReportPageValidation(PBIReportSetup: Enum "PBI Report Setup"): Guid
36+
var
37+
PowerBIAssistedSetup: Page "PowerBI Assisted Setup";
38+
DeploySelectionPage: Page "PBI Report Deploy. Selection";
39+
ConfiguredReportId: Guid;
40+
ReportNotSetupErr: Label 'Your report has not been setup in PowerBI Reports Setup. You need to set up this report in order to view it.', Comment = '%1 = report name';
41+
begin
42+
EnsureUserAcceptedPowerBITerms();
43+
ConfiguredReportId := GetConfiguredReportId(PBIReportSetup);
44+
if not IsNullGuid(ConfiguredReportId) then
45+
exit(ConfiguredReportId);
46+
PromptOpeningReportDeploymentsWhenInProgress(PBIReportSetup);
47+
if PowerBIAssistedSetup.RunModal() = Action::OK then
48+
if PowerBIAssistedSetup.IsDeployOOBReportsSelected() then
49+
DeploySelectionPage.RunModal();
50+
ConfiguredReportId := GetConfiguredReportId(PBIReportSetup);
51+
if not IsNullGuid(ConfiguredReportId) then
52+
exit(ConfiguredReportId);
53+
PromptOpeningReportDeploymentsWhenInProgress(PBIReportSetup);
54+
Error(ReportNotSetupErr)
55+
end;
56+
57+
local procedure GetConfiguredReportId(PBIReportSetup: Enum "PBI Report Setup"): Guid
58+
var
59+
PowerBIReportsSetup: Record "PowerBI Reports Setup";
60+
RecRef: RecordRef;
61+
ReportSetup: Interface "PBI Report Setup";
62+
ConfiguredReportId: Guid;
63+
begin
64+
PowerBIReportsSetup.GetOrCreate();
65+
RecRef.GetTable(PowerBIReportsSetup);
66+
ReportSetup := PBIReportSetup;
67+
ConfiguredReportId := RecRef.Field(ReportSetup.GetSetupReportIdFieldNo()).Value();
68+
exit(ConfiguredReportId)
69+
end;
70+
2971
procedure GetReportIdAndEnsureSetup(ReportName: Text; FieldId: Integer) ReportId: Guid
3072
var
3173
AssistedSetup: Page "PowerBI Assisted Setup";
@@ -40,6 +82,47 @@ codeunit 36962 "Power BI Report Setup"
4082
end;
4183
end;
4284

85+
procedure FindReportSetup(DeployableReportType: Enum "Power BI Deployable Report"; var ReportSetup: Interface "PBI Report Setup"): Boolean
86+
var
87+
Ordinal: Integer;
88+
begin
89+
foreach Ordinal in Enum::"PBI Report Setup".Ordinals() do begin
90+
ReportSetup := Enum::"PBI Report Setup".FromInteger(Ordinal);
91+
if ReportSetup.GetDeployableReportType() = DeployableReportType then
92+
exit(true);
93+
end;
94+
Clear(ReportSetup);
95+
exit(false);
96+
end;
97+
98+
local procedure IsReportBeingDeployed(ReportSetup: Interface "PBI Report Setup"): Boolean
99+
var
100+
PowerBIDeployment: Record "Power BI Deployment";
101+
begin
102+
if not PowerBIDeployment.Get(ReportSetup.GetDeployableReportType()) then
103+
exit(false);
104+
PowerBIDeployment.GetUploadStatus();
105+
exit(not (PowerBIDeployment.GetUploadStatus() in [
106+
Enum::"Power BI Upload Status"::Completed,
107+
Enum::"Power BI Upload Status"::Failed,
108+
Enum::"Power BI Upload Status"::Skipped,
109+
Enum::"Power BI Upload Status"::PendingDeletion]));
110+
end;
111+
112+
local procedure PromptOpeningReportDeploymentsWhenInProgress(ReportSetup: Interface "PBI Report Setup"): Boolean
113+
var
114+
ConfirmMgt: Codeunit "Confirm Management";
115+
ReportDeployingQst: Label 'Your %1 report is being deployed to Power BI. Would you like to open the Power BI Report Deployments page to track the status?', Comment = '%1 = report name';
116+
DeployableReport: Interface "Power BI Deployable Report";
117+
begin
118+
DeployableReport := ReportSetup.GetDeployableReportType();
119+
if IsReportBeingDeployed(ReportSetup) then begin
120+
if ConfirmMgt.GetResponse(StrSubstNo(ReportDeployingQst, DeployableReport.GetReportName())) then
121+
Page.Run(Page::"Power BI Report Deployments");
122+
Error('');
123+
end;
124+
end;
125+
43126
local procedure GetReportId(FieldId: Integer): Guid
44127
var
45128
PowerBiReportsSetup: Record "PowerBI Reports Setup";

0 commit comments

Comments
 (0)