Why do you need this change?
Our extension computes an alternate-unit-of-measure sales figure from our own Item Ledger Entry sum, which is expected to disagree with the standard FlowField-sourced Sales (Qty.) , that disagreement is the entire point of the customization. The standard OnAfterGetRecord trigger calculates Sales (Qty. ) via CalcFields and immediately decides, in the same statement block, whether to CurrReport.Skip() the record based on PrintOnlyIfSales and that FlowField value before any extension trigger (modify(Item) { trigger OnAfterAfterGetRecord }) ever runs. PrintOnlyIfSales itself is a private global with no accessible getter and it cannot be read from any kind of extension trigger, including a request-page control extension's OnAfterValidate.
Net effect: when "Only Items with Sales" is checked, an item, our own calculation shows as having real (alternate-UOM) sales can be silently skipped before our code runs, and an item we'd consider zero-sales can still print. We currently ship a second, custom checkbox that only produces a correct result when the standard "Only Items with Sales" is left unchecked which is a workaroud. A single event exposing the already-computed skip decision, raised after CalcFields and before CurrReport.Skip() , would let us fold our own figures into the one decision the user sees.
Describe the request
Add an integration event immediately after the existing CalcFields call and before the existing skip check, exposing the record and the already-computed skip boolean by var so a subscriber can override it in either direction:
trigger OnAfterGetRecord()
begin
NoShow := false;
if BreakdownByVariant then begin
NoVariant := Text002;
if AnyVariants() then
NoShow := true;
end;
SetRange("Variant Filter");
CalcFields("Sales (Qty.)", "Sales (LCY)", "COGS (LCY)");
SkipRecord := ("Sales (Qty.)" = 0) and PrintOnlyIfSales;
OnAfterGetRecordOnBeforePrintOnlyIfSalesCheck(Rec, PrintOnlyIfSales, SkipRecord);
if SkipRecord then
CurrReport.Skip();
Profit := "Sales (LCY)" - "COGS (LCY)";
...
end;
Event Signature:
[IntegrationEvent(false, false)]
local procedure OnAfterGetRecordOnBeforePrintOnlyIfSalesCheck(var Item: Record Item; PrintOnlyIfSales: Boolean; var SkipRecord: Boolean)
begin
end;
Alternatives evaluated:
- Reading
PrintOnlyIfSales from a request-page control extension's OnAfterValidate , confirmed by the compiler that the variable is inaccessible from every kind of extension trigger, not just dataset ones.
- Recomputing the entire skip/Profit/ItemProfitPct block ourselves inside a
modify(Item) { trigger OnBeforeAfterGetRecord }, not viable even with access, because that trigger runs before the base's own CalcFields, so "Sales (Qty.)" isn't populated yet at that point.
Internal work item: AB#644155
Why do you need this change?
Our extension computes an alternate-unit-of-measure sales figure from our own Item Ledger Entry sum, which is expected to disagree with the standard FlowField-sourced
Sales (Qty.), that disagreement is the entire point of the customization. The standardOnAfterGetRecordtrigger calculatesSales (Qty. )viaCalcFieldsand immediately decides, in the same statement block, whether toCurrReport.Skip()the record based onPrintOnlyIfSalesand that FlowField value before any extension trigger (modify(Item) { trigger OnAfterAfterGetRecord }) ever runs.PrintOnlyIfSalesitself is a private global with no accessible getter and it cannot be read from any kind of extension trigger, including a request-page control extension'sOnAfterValidate.Net effect: when "Only Items with Sales" is checked, an item, our own calculation shows as having real (alternate-UOM) sales can be silently skipped before our code runs, and an item we'd consider zero-sales can still print. We currently ship a second, custom checkbox that only produces a correct result when the standard "Only Items with Sales" is left unchecked which is a workaroud. A single event exposing the already-computed skip decision, raised after
CalcFieldsand beforeCurrReport.Skip(), would let us fold our own figures into the one decision the user sees.Describe the request
Add an integration event immediately after the existing
CalcFieldscall and before the existing skip check, exposing the record and the already-computed skip boolean byvarso a subscriber can override it in either direction:Event Signature:
Alternatives evaluated:
PrintOnlyIfSalesfrom a request-page control extension'sOnAfterValidate, confirmed by the compiler that the variable is inaccessible from every kind of extension trigger, not just dataset ones.modify(Item) { trigger OnBeforeAfterGetRecord }, not viable even with access, because that trigger runs before the base's ownCalcFields, so"Sales (Qty.)"isn't populated yet at that point.Internal work item: AB#644155