microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
770 stars 610 forks source link

[Event Request] Codeunit 9200 "Matrix Management" - OnBeforeGeneratePeriodMatrixData #27019

Closed 1languste closed 3 weeks ago

1languste commented 1 month ago

Describe the request

I would like to do additional business logic before the matrix data is generated. Therefore, I request the following event:

procedure GeneratePeriodMatrixData(SetWanted: Option; MaximumSetLength: Integer; UseNameForCaption: Boolean; PeriodType: Enum "Analysis Period Type"; DateFilter: Text; var RecordPosition: Text; var CaptionSet: array[32] of Text[80]; var CaptionRange: Text; var CurrSetLength: Integer; var PeriodRecords: array[32] of Record Date temporary)
var
    Calendar: Record Date;
    PeriodPageMgt: Codeunit PeriodPageManagement;
    Steps: Integer;
    IsHandled: Boolean;
begin
    // ...
    if not FindDate('-', Calendar, PeriodType, false) then begin
        RecordPosition := '';
        Error(Text003);
    end;
    // NEW BEGIN
    OnBeforeGeneratePeriodMatrixData(SetWanted, Calendar, PeriodType);
    // NEW END
    case "Matrix Page Step Type".FromInteger(SetWanted) of
        "Matrix Page Step Type"::Initial:
            begin
                if (PeriodType = PeriodType::"Accounting Period") or (DateFilter <> '') then
                    FindDate('-', Calendar, PeriodType, true)
                else
                    Calendar."Period Start" := 0D;
                FindDate('=><', Calendar, PeriodType, true);
    // ...
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeGeneratePeriodMatrixData(SetWanted: Option; var Calendar: Record Date; PeriodType: Enum "Analysis Period Type")
begin
end;

Additional context

I want to do additional date calculation for the initial matrix page step type before the default code is executed. Internal work item: AB#545269

JesperSchulz commented 3 weeks ago

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 23206.