Hello,
I would like to request the addition of a new event in the function "ValidateReceivingCompanyInfo" within Codeunit 6109 "E-Document Import Helper".
Currently, the validation checks the "VAT Registration No.", but in our case, beacause of Belgian localization we need to check on the "Enterprise No." instead. To accommodate this scenario and allow for greater flexibility, it would be beneficial if you could add a corresponding event to extend this function, enabling developers to override the default validation or add custom logic.
Additional context
procedure ValidateReceivingCompanyInfo(EDocument: Record "E-Document")
var
CompanyInformation: Record "Company Information";
IsHandled: Boolean;
begin
CompanyInformation.Get();
if (EDocument."Receiving Company GLN" = '') and (EDocument."Receiving Company VAT Reg. No." = '') then begin
ValidateReceivingCompanyInfoByNameAndAddress(EDocument);
exit;
end;
OnBeforeCheckGLNandVATRegistrationNo(EDocument,IsHandled);
if not IsHandled then
if (CompanyInformation.GLN = '') and (CompanyInformation."VAT Registration No." = '') then
EDocErrorHelper.LogErrorMessage(EDocument, CompanyInformation, CompanyInformation.FieldNo(GLN), MissingCompanyInfoSetupErr);
if EDocument."Receiving Company GLN" <> '' then
if not (CompanyInformation.GLN in ['', EDocument."Receiving Company GLN"]) then
EDocErrorHelper.LogErrorMessage(EDocument, CompanyInformation, CompanyInformation.FieldNo(GLN), StrSubstNo(InvalidCompanyInfoGLNErr, EDocument."Receiving Company GLN"));
if not (ExtractVatRegNo(CompanyInformation."VAT Registration No.", '') in ['', ExtractVatRegNo(EDocument."Receiving Company VAT Reg. No.", '')]) then
EDocErrorHelper.LogErrorMessage(EDocument, CompanyInformation, CompanyInformation.FieldNo("VAT Registration No."), StrSubstNo(InvalidCompanyInfoVATRegNoErr, EDocument."Receiving Company VAT Reg. No."));
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckGLNandVATRegistrationNo(var EDocument: Record "E-Document"; var IsHandled: Boolean)
begin
end;
This would be beneficial for everyone extending the e-doc framework, since not all formats uses VAT och GLN identities. To overcome this issue, I had to duplicate code by adding a new format.
Describe the request
Hello, I would like to request the addition of a new event in the function "ValidateReceivingCompanyInfo" within Codeunit 6109 "E-Document Import Helper". Currently, the validation checks the "VAT Registration No.", but in our case, beacause of Belgian localization we need to check on the "Enterprise No." instead. To accommodate this scenario and allow for greater flexibility, it would be beneficial if you could add a corresponding event to extend this function, enabling developers to override the default validation or add custom logic.
Additional context
Internal work item: AB#548952