BCApps icon indicating copy to clipboard operation
BCApps copied to clipboard

Add OnAfterMatrixOnAfterGetRecord event to page 9229 "Res. Avail. (Service) Matrix"

Open ACJStopka opened this issue 2 months ago • 1 comments

Why do you need this change?

Please add an OnAfterMatrixOnAfterGetRecord integration event to page 9229 "Res. Avail. (Service) Matrix".

Business scenario

We extend resource availability with hours allocated to assembly orders. These hours must be deducted from every calculated availability cell in the matrix.

The calculation is based on a custom FlowField on the Resource table, filtered by the current resource and each matrix column's date filter.

Current extensibility limitation

Page 9229 currently exposes the following event:

[IntegrationEvent(false, false)] local procedure OnBeforeMatrixOnAfterGetRecord( var MatrixRec: Record Resource; var MATRIX_CellData: array[32] of Decimal; var MatrixColumnDateFilters: array[32] of Record Date; var IsHandled: Boolean) begin end;

This event is raised before the standard procedure initializes MatrixRec with the current page record:

MatrixRec.Reset(); MatrixRec.SetRange("No.", Rec."No.");

The subscriber therefore has no access to the resource represented by the current row (Rec."No."). It cannot safely replace the standard calculation using IsHandled := true.

Changing the signature of the existing event could be a breaking change for existing subscribers. A new event after the standard calculation would avoid that compatibility risk.

Describe the request

Proposed event Please raise the following event at the end of MatrixOnAfterGetRecord(), after the standard matrix cells have been calculated and before or after SetVisible():

[IntegrationEvent(false, false)] local procedure OnAfterMatrixOnAfterGetRecord( Resource: Record Resource; var MatrixCellData: array[32] of Decimal; MatrixColumnDateFilters: array[32] of Record Date) begin end;

Suggested placement:

local procedure MatrixOnAfterGetRecord() var I: Integer; IsHandled: Boolean; begin IsHandled := false; OnBeforeMatrixOnAfterGetRecord(MatrixRec, MATRIX_CellData, MatrixColumnDateFilters, IsHandled); if IsHandled then exit;

MatrixRec.Reset();
MatrixRec.SetRange("No.", Rec."No.");
for I := 1 to ArrayLen(MatrixColumnDateFilters) do begin
    MATRIX_CellData[I] := 0;
    MatrixRec.SetRange(
        "Date Filter",
        MatrixColumnDateFilters[I]."Period Start",
        MatrixColumnDateFilters[I]."Period End");
    if MatrixRec.Find('-') then
        repeat
            MatrixRec.CalcFields(Capacity, "Qty. on Service Order");
            MATRIX_CellData[I] := MatrixRec.Capacity - MatrixRec."Qty. on Service Order";
        until MatrixRec.Next() = 0;
end;

OnAfterMatrixOnAfterGetRecord(Rec, MATRIX_CellData, MatrixColumnDateFilters);

SetVisible();

end;

Example extension usage:

[EventSubscriber( ObjectType::Page, Page::"Res. Avail. (Service) Matrix", OnAfterMatrixOnAfterGetRecord, '', false, false)] local procedure ResAvailServiceMatrix_OnAfterMatrixOnAfterGetRecord( Resource: Record Resource; var MatrixCellData: array[32] of Decimal; MatrixColumnDateFilters: array[32] of Record Date) var ResourceForCalculation: Record Resource; ColumnNo: Integer; begin ResourceForCalculation.SetRange("No.", Resource."No.");

for ColumnNo := 1 to ArrayLen(MatrixColumnDateFilters) do begin
    ResourceForCalculation.SetRange(
        "Date Filter",
        MatrixColumnDateFilters[ColumnNo]."Period Start",
        MatrixColumnDateFilters[ColumnNo]."Period End");
    ResourceForCalculation.CalcFields("Qty.onAssemblyOrderAlloc._pte");

    MatrixCellData[ColumnNo] -=
        ResourceForCalculation."Qty.onAssemblyOrderAlloc._pte";
end;

end;

Provide an implementation (optional)

  • [ ] I will provide the implementation for this extensibility request

ACJStopka avatar Sep 07 '26 11:09 ACJStopka

Hi @ACJStopka,

Thank you for your extensibility request. To help us process it efficiently, please update the issue to include the required information.

📚 Extensibility Guidelines

Missing Information:

  • Clarification on existing event usage: Please confirm whether updating the existing OnBeforeMatrixOnAfterGetRecord event with the additional context needed for your scenario would be acceptable. If not, explain why a separate OnAfterMatrixOnAfterGetRecord event is still required beyond the current initialization timing limitation.

Please update the issue with the missing details. We'll automatically re-analyze once updated.

[!NOTE] Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.

[!TIP] Is the triage result incorrect? Reply with /not-accurate and briefly explain what was wrong. Your feedback improves future responses.

github-actions[bot] avatar Sep 08 '26 12:09 github-actions[bot]