KVSKBAServiceSubscribers#
Events#
OnBeforeOnAfterValidateVariantCodeServiceItemLine(Record Service Item Line, Record Service Item Line, Integer, Boolean) :#
Summary: Integration event that allows customization before variant code validation on Service Item Line.
[IntegrationEvent(false, false)]
local procedure OnBeforeOnAfterValidateVariantCodeServiceItemLine(var ServiceItem: Record "Service Item Line"; xServiceItemLine: Record "Service Item Line"; CurrFieldNo: Integer; var Handled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAServiceSubscribers", 'OnBeforeOnAfterValidateVariantCodeServiceItemLine', '', false, false)]
local procedure DoSomethingOnBeforeOnAfterValidateVariantCodeServiceItemLine(var ServiceItem: Record "Service Item Line"; xServiceItemLine: Record "Service Item Line"; CurrFieldNo: Integer; var Handled: Boolean)
begin
end;
Parameters:
ServiceItem: Service Item Line being validated.xServiceItemLine: Service Item Line record with original values before validation.CurrFieldNo: Field number of the field being validated.Handled: Set to TRUE to bypass standard variant code validation logic.
Remarks: This event fires in the OnServiceItemLineOnAfterValidateVariantCode EventSubscriber before the standard validation logic checks if the item variant is blocked. It allows subscribers to implement custom validation logic or bypass the standard blocking check.
Standard behavior (when Handled = FALSE):
- Calls ItemLib.CheckItemVariantBlockedTableServiceItemLine to verify the variant is not blocked
- This prevents using blocked variants on service item lines
Subscribers can:
- Set Handled = TRUE to skip the blocking check entirely
- Implement custom variant validation rules
- Add logging or notifications when variant code changes
- Perform additional checks based on custom fields
- Allow blocked variants under specific circumstances
Use cases:
- Custom variant validation requirements that differ from standard blocking logic
- Allowing specific users or scenarios to use blocked variants
- Implementing workflow or approval processes for variant changes
- Adding customer-specific validation rules for service item variants
Note: This event is called during the OnAfterValidateEvent for "Variant Code" on Service Item Line,
which fires after standard Business Central variant code validation has completed.