-
Notifications
You must be signed in to change notification settings - Fork 687
Description
Why do you need this change?
Please add a new integration event in the OnValidate trigger of the "No." field in table "Production BOM Line".
The event should be placed before the call to Item.TestField('Base Unit of Measure'), and should include a var IsHandled: Boolean parameter, allowing subscribers to bypass this TestField call if needed.
We have explored the following alternative events:
OnValidateNoOnAfterAssignItemFields&OnAfterValidateNobut as we want to add a TestField after theItem.TestField("Base Unit of Measure");those event will not fulfill our purpose
Justification for IsHandled:
We need to use IsHandled because without it standard code would trigger additional validations that conflict with custom process. We need to avoid the standard code as below:
Performance Considerations:
The event would typically execute on every modification of the "No." field in Production BOM Line table and the value of field "Type" is equal to "Item". However, due to standard NAV/BC event design and our intended implementation (where IsHandled will rarely be set to true), the performance impact should be negligible. This pattern is widely adopted in other core tables and fields for flexible extension with minimal overhead.
Data Sensitivity Review:
The event parameters do not contain sensitive or confidential data. Exposing these is consistent with existing event signatures, and no additional data beyond what is already available in the production order line is required.
Multi-Extension Interaction:
Extensions that rely on this event must coordinate via dependency declarations. Partners can use EventSubscriberInstance = Manual to control execution order. The pattern is consistent with other core IsHandled events, so developers are familiar with the implications.
Describe the request
Requested event placement and usage:
trigger OnValidate()
var
Item: Record Item;
IsHandled: Boolean; //New Variable
begin
TestField(Type);
TestStatus();
case Type of
Type::Item:
begin
IsHandled := true;
Item.Get("No.");
OnValidateNoOnBeforeAssignItemFields(Rec, Item, xRec, CurrFieldNo, IsHandled); //New Event
if IsHandled then // New Code
exit;
Description := Item.Description;
Item.TestField("Base Unit of Measure");
"Unit of Measure Code" := Item."Base Unit of Measure";
"Scrap %" := Item."Scrap %";
if "No." <> xRec."No." then
"Variant Code" := '';
OnValidateNoOnAfterAssignItemFields(Rec, Item, xRec, CurrFieldNo);
end;
Type::"Production BOM":
begin
ProductionBOMHeader.Get("No.");
ProductionBOMHeader.TestField("Unit of Measure Code");
Description := ProductionBOMHeader.Description;
"Unit of Measure Code" := ProductionBOMHeader."Unit of Measure Code";
OnValidateNoOnAfterAssignProdBOMFields(Rec, ProductionBOMHeader, xRec, CurrFieldNo);
end;
end;
OnAfterValidateNo(Rec);
end;Event signature:
[IntegrationEvent(false, false)]
local procedure OnValidateNoOnBeforeAssignItemFields(var ProductionBOMLine: Record "AL Production BOM Line"; Item: Record Item; var xProductionBOMLine: Record "AL Production BOM Line"; CallingFieldNo: Integer; IsHandled: Boolean)
begin
end;