Why do you need this change?
We need an event inside the trigger OnValidate of the field "Location Code" of the table "Work Center", in order to manage a farther custom "if statement" before invoking the Error(LocationMustBeBinMandatoryErr, Location.Code, "No.").
It is necessary to manage the IsHandled variable, since, without it, we are supposed to add our custom code before the validation of the field "Location Code" in every single place of the code where the validation is made.
In other words, there are no alternative events before Error(LocationMustBeBinMandatoryErr, Location.Code, "No."); to add a further check.
Existing events or alternative patterns considered
We evaluated the existing extensibility points on table 99000754 "Work Center" and related manufacturing objects. Currently, there is no event raised between the retrieval of the Location record and the execution of:
Error(LocationMustBeBinMandatoryErr, Location.Code, "No.");
There are also no events that allow partners to influence or bypass only the "Bin Mandatory" validation without replacing the entire OnValidate logic.
Alternative approaches considered were:
- Subscribing to events after the validation: insufficient because the error has already been raised.
- Duplicating the validation logic in every place where
Validate("Location Code") is called: not maintainable and prone to regressions when the base application changes.
- Replacing the entire table logic through other customization techniques: unnecessarily invasive for a single validation check.
Therefore, an OnBefore... event is required to provide a proper extensibility point.
Performance/frequency impact assessment
The validation is executed only when the "Location Code" field of a Work Center is modified, either by a user action or by code calling Validate("Location Code").
The proposed change adds:
OnBeforeCheckLocationOnValidateLocation(IsHandled, Rec);
which introduces only a single event invocation and a Boolean check. The performance impact is therefore negligible and does not affect normal manufacturing processes or batch operations.
Sensitive data exposure review
The event exposes only:
var IsHandled: Boolean
var WorkCenter: Record "Work Center"
The Work Center record does not contain sensitive or personally identifiable information. The change does not expose any additional business data beyond what is already available to extensions through existing events and record access.
Therefore, this change does not introduce any sensitive data exposure concerns.
Multi-extension conflict mitigation
As with any IsHandled event, there is an inherent risk that multiple extensions subscribe to the event and set IsHandled := true.
Potential conflicts include:
- One extension bypassing the standard
"Bin Mandatory" validation while another extension expects the standard validation to execute.
- Multiple extensions implementing different replacement validation logic, with subscriber execution order not being guaranteed.
However, the risk is limited because:
- The event is narrowly scoped and affects only the
"Location Code" validation of the Work Center table.
- Extensions should set
IsHandled := true only when intentionally replacing the standard validation with their own equivalent logic.
- Extensions that only need to perform additional checks can subscribe without modifying
IsHandled, allowing the standard behavior to continue.
Without this event, partners are forced to duplicate the base validation logic in multiple places, which introduces a significantly higher risk of maintenance issues and behavioral inconsistencies than the proposed extensibility point.
Describe the request
In trigger OnValidate of field(7300; "Location Code"; Code[10])of table 99000754 "Work Center" we need an event:
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckLocationOnValidateLocation(var Ishandled: Boolean; var WorkCenter: Record "Work Center")
begin
end;
Changes between **:
trigger OnValidate()
var
Location: Record Location;
MachineCenter: Record "Machine Center";
AutoUpdate: Boolean;
**ishandled: boolean;**
begin
if "Location Code" <> xRec."Location Code" then begin
if "Location Code" <> '' then begin
Location.Get("Location Code");
**ishandled := false;
OnBeforeCheckLocationOnValidateLocation(ishandled, rec);
if not ishandled then**
if not Location."Bin Mandatory" then
Error(LocationMustBeBinMandatoryErr, Location.Code, "No.");
end;
if "Open Shop Floor Bin Code" <> '' then
if ConfirmAutoRemovalOfBinCode(AutoUpdate) then
Validate("Open Shop Floor Bin Code", '')
else
TestField("Open Shop Floor Bin Code", '');
if "To-Production Bin Code" <> '' then
if ConfirmAutoRemovalOfBinCode(AutoUpdate) then
Validate("To-Production Bin Code", '')
else
TestField("To-Production Bin Code", '');
if "From-Production Bin Code" <> '' then
if ConfirmAutoRemovalOfBinCode(AutoUpdate) then
Validate("From-Production Bin Code", '')
else
TestField("From-Production Bin Code", '');
MachineCenter.SetCurrentKey("Work Center No.");
MachineCenter.SetRange("Work Center No.", "No.");
if MachineCenter.FindSet(true) then
repeat
MachineCenter."Location Code" := "Location Code";
if MachineCenter."Open Shop Floor Bin Code" <> '' then
if ConfirmAutoRemovalOfBinCode(AutoUpdate) then
MachineCenter.Validate("Open Shop Floor Bin Code", '')
else
MachineCenter.TestField("Open Shop Floor Bin Code", '');
if MachineCenter."To-Production Bin Code" <> '' then
if ConfirmAutoRemovalOfBinCode(AutoUpdate) then
MachineCenter.Validate("To-Production Bin Code", '')
else
MachineCenter.TestField("To-Production Bin Code", '');
if MachineCenter."From-Production Bin Code" <> '' then
if ConfirmAutoRemovalOfBinCode(AutoUpdate) then
MachineCenter.Validate("From-Production Bin Code", '')
else
MachineCenter.TestField("From-Production Bin Code", '');
MachineCenter.Modify(true);
until MachineCenter.Next() = 0;
end;
end;
Internal work item: AB#640861
Why do you need this change?
We need an event inside the trigger OnValidate of the field "Location Code" of the table "Work Center", in order to manage a farther custom "if statement" before invoking the Error(LocationMustBeBinMandatoryErr, Location.Code, "No.").
It is necessary to manage the IsHandled variable, since, without it, we are supposed to add our custom code before the validation of the field "Location Code" in every single place of the code where the validation is made.
In other words, there are no alternative events before Error(LocationMustBeBinMandatoryErr, Location.Code, "No."); to add a further check.
Existing events or alternative patterns considered
We evaluated the existing extensibility points on table 99000754 "Work Center" and related manufacturing objects. Currently, there is no event raised between the retrieval of the
Locationrecord and the execution of:There are also no events that allow partners to influence or bypass only the
"Bin Mandatory"validation without replacing the entireOnValidatelogic.Alternative approaches considered were:
Validate("Location Code")is called: not maintainable and prone to regressions when the base application changes.Therefore, an
OnBefore...event is required to provide a proper extensibility point.Performance/frequency impact assessment
The validation is executed only when the
"Location Code"field of a Work Center is modified, either by a user action or by code callingValidate("Location Code").The proposed change adds:
which introduces only a single event invocation and a Boolean check. The performance impact is therefore negligible and does not affect normal manufacturing processes or batch operations.
Sensitive data exposure review
The event exposes only:
var IsHandled: Booleanvar WorkCenter: Record "Work Center"The
Work Centerrecord does not contain sensitive or personally identifiable information. The change does not expose any additional business data beyond what is already available to extensions through existing events and record access.Therefore, this change does not introduce any sensitive data exposure concerns.
Multi-extension conflict mitigation
As with any
IsHandledevent, there is an inherent risk that multiple extensions subscribe to the event and setIsHandled := true.Potential conflicts include:
"Bin Mandatory"validation while another extension expects the standard validation to execute.However, the risk is limited because:
"Location Code"validation of theWork Centertable.IsHandled := trueonly when intentionally replacing the standard validation with their own equivalent logic.IsHandled, allowing the standard behavior to continue.Without this event, partners are forced to duplicate the base validation logic in multiple places, which introduces a significantly higher risk of maintenance issues and behavioral inconsistencies than the proposed extensibility point.
Describe the request
In trigger OnValidate of field(7300; "Location Code"; Code[10])of table 99000754 "Work Center" we need an event:
Changes between **:
Internal work item: AB#640861