Why do you need this change?
Table 246 "Requisition Line", field 8 Quantity, OnValidate. The first two statements of the
trigger assign the field and its base quantity unconditionally, before any publisher is reached:
Quantity := UOMMgt.RoundAndValidateQty(Quantity, "Qty. Rounding Precision", FieldCaption(Quantity));
"Quantity (Base)" := UOMMgt.CalcBaseQty(...);
The first publisher in the trigger, OnValidateQuantityOnBeforeGetDirectCost, sits inside
if Type = Type::Item then and is only reached after both statements have already run. Both
UOMMgt.RoundAndValidateQty and UOMMgt.CalcBaseQty raise rounding-precision errors, so for the
lines we care about the trigger errors out before any extension code can run at all. For line
types other than Item the trigger contains no publisher whatsoever.
Our solution plans supply for produce/manufacturing items whose base quantity is derived from our
own unit-of-measure model, and whose rounding-precision validation has to run at a different point
in the sequence and against a different precision than the base app applies. We need to substitute
those two statements for our own line types while leaving standard behaviour untouched for every
other line, and we need one point at the end of the trigger to run our follow-up validation in the
correct order.
Precedent: the sibling field in the same table already has this
Field 5408 "Quantity (Base)" carries exactly the pattern being requested:
trigger OnValidate()
var
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeValidateQuantityBase(Rec, IsHandled, xRec, CurrFieldNo, CurrentFieldNo);
if IsHandled then
exit;
TestProdOrderNo();
TestField("Qty. per Unit of Measure", 1);
Validate(Quantity, "Quantity (Base)");
end;
Quantity and "Quantity (Base)" are two entry points into the same calculation and only one of
them is extensible. This request makes the pair consistent.
Describe the request
Two new integration events on Table 246 "Requisition Line", field 8 Quantity, OnValidate.
Please add them to main and to the latest release branch.
Proposed publisher location
Object: Table 246 "Requisition Line"
Trigger: field(8; Quantity; Decimal) — OnValidate
Placement: OnBeforeValidateQuantity as the first statement of the trigger, ahead of
UOMMgt.RoundAndValidateQty; OnAfterValidateQuantity as the last statement, outside
if Type = Type::Item then, so it is raised for every line type.
Publisher declarations keep the alphabetical order already used in this object:
OnAfterValidateQuantity between OnAfterValidateFields and
OnAfterValidateShortcutDimCode; OnBeforeValidateQuantity immediately before
OnBeforeValidateQuantityBase.
**AFTER
trigger OnValidate()
var
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeValidateQuantity(Rec, IsHandled, xRec, CurrFieldNo, CurrentFieldNo);
if IsHandled then
exit;
Quantity := UOMMgt.RoundAndValidateQty(Quantity, "Qty. Rounding Precision", FieldCaption(Quantity));
"Quantity (Base)" :=
UOMMgt.CalcBaseQty(
"No.", "Variant Code", "Unit of Measure Code", Quantity, "Qty. per Unit of Measure",
"Qty. Rounding Precision (Base)", FieldCaption("Qty. Rounding Precision"), FieldCaption(Quantity),
FieldCaption("Quantity (Base)"));
if Type = Type::Item then begin
// unchanged
end;
OnAfterValidateQuantity(Rec, xRec, CurrFieldNo, CurrentFieldNo);
end;
Proposed publishers
[IntegrationEvent(false, false)]
local procedure OnBeforeValidateQuantity(var RequisitionLine: Record "Requisition Line"; var IsHandled: Boolean; xRequisitionLine: Record "Requisition Line"; CallingFieldNo: Integer; GlobalCurrentFieldNo: Integer)
begin
end;
[IntegrationEvent(false, false)]
local procedure OnAfterValidateQuantity(var RequisitionLine: Record "Requisition Line"; xRequisitionLine: Record "Requisition Line"; CallingFieldNo: Integer; GlobalCurrentFieldNo: Integer)
begin
end;
Provide an implementation (optional)
Why do you need this change?
Table 246 "Requisition Line", field 8
Quantity,OnValidate. The first two statements of thetrigger assign the field and its base quantity unconditionally, before any publisher is reached:
The first publisher in the trigger,
OnValidateQuantityOnBeforeGetDirectCost, sits insideif Type = Type::Item thenand is only reached after both statements have already run. BothUOMMgt.RoundAndValidateQtyandUOMMgt.CalcBaseQtyraise rounding-precision errors, so for thelines we care about the trigger errors out before any extension code can run at all. For line
types other than
Itemthe trigger contains no publisher whatsoever.Our solution plans supply for produce/manufacturing items whose base quantity is derived from our
own unit-of-measure model, and whose rounding-precision validation has to run at a different point
in the sequence and against a different precision than the base app applies. We need to substitute
those two statements for our own line types while leaving standard behaviour untouched for every
other line, and we need one point at the end of the trigger to run our follow-up validation in the
correct order.
Precedent: the sibling field in the same table already has this
Field 5408 "Quantity (Base)" carries exactly the pattern being requested:
Quantityand"Quantity (Base)"are two entry points into the same calculation and only one ofthem is extensible. This request makes the pair consistent.
Describe the request
Two new integration events on Table 246 "Requisition Line", field 8
Quantity,OnValidate.Please add them to
mainand to the latest release branch.Proposed publisher location
Object: Table 246 "Requisition Line"
Trigger: field(8; Quantity; Decimal) — OnValidate
Placement:
OnBeforeValidateQuantityas the first statement of the trigger, ahead ofUOMMgt.RoundAndValidateQty;OnAfterValidateQuantityas the last statement, outsideif Type = Type::Item then, so it is raised for every line type.Publisher declarations keep the alphabetical order already used in this object:
OnAfterValidateQuantitybetweenOnAfterValidateFieldsandOnAfterValidateShortcutDimCode;OnBeforeValidateQuantityimmediately beforeOnBeforeValidateQuantityBase.**AFTER
Proposed publishers
Provide an implementation (optional)