-
Notifications
You must be signed in to change notification settings - Fork 688
Description
Hi @tomasevicst ,
Please add an event at the start of validation trigger of field "Production BOM Version Code".
The event should include an IsHandled flag so extensions can skip the standard Validate("Unit of Measure Code") logic and assign the field value directly without triggering validation.
Meaningful Justification: The partner needs to avoid the standard validation of the "Unit of Measure Code" in specific business scenarios, as outlined in the image provided. The standard validation logic is too restrictive for their workflow and prevents them from applying custom rules when setting the "Unit of Measure Code." By bypassing the default validation, they are able to implement custom logic that better aligns with their business processes.

Alternatives Evaluated: We have reviewed all existing events in Table 5406 ("Prod. Order Line") and related codeunits, including OnBeforeValidate and OnAfterValidate events for specific fields. However, none provide the ability to entirely bypass (and not just supplement) the validation logic in the OnValidate trigger of "Production BOM Version Code", nor do they allow us to replace the standard call to Validate("Unit of Measure Code", …) with our own logic.
Justification for IsHandled: A standard event without the IsHandled pattern does not let us stop the execution of the default validation code. In our use case, we must skip the standard Validate("Unit of Measure Code", …) because it will reject our external UOM assignments or overwrite them, leading to data inconsistencies and integration failures. Only with an IsHandled event can we fully replace the default behavior with our custom logic, ensuring our process can be properly extended without risking unintended validation rollbacks.
Performance Considerations: The event would typically execute on every modification of the "Production BOM Version Code" field in production order lines. 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 (the Prod. Order Line record and xProdOrderLine) 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.
My suggestion is to create a universal event with the possibility to overrule the validation trigger as below:
field(99000750; "Production BOM Version Code"; Code[20])
{
Caption = 'Production BOM Version Code';
TableRelation = "Production BOM Version"."Version Code" where("Production BOM No." = field("Production BOM No."));
trigger OnValidate()
var
ProdBOMVersion: Record "Production BOM Version";
IsHandled: Boolean; //New Variable
begin
IsHandled := false; //New
OnBeforeValidateProductionBOMVersionCode(Rec, xRec, IsHandled); //New Event
if IsHandled or ("Production BOM Version Code" = '') then //Added new statement part
exit;
ProdBOMVersion.Get("Production BOM No.", "Production BOM Version Code");
ProdBOMVersion.TestField(Status, ProdBOMVersion.Status::Certified);
Validate("Unit of Measure Code", ProdBOMVersion."Unit of Measure Code");
end;
}
}
[IntegrationEvent(false, false)]
local procedure OnBeforeValidateProductionBOMVersionCode(var ProdOrderLine: Record "Prod. Order Line"; xProdOrderLine: Record "Prod. Order Line"; var IsHandled: Boolean)
begin
end;
Internal work item: [AB#619486](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/619486)