Skip to content

[Event Request] codeunit 4810 IntrastatReportManagement - GetVATRegNo #30081

Description

Why do you need this change?

I have an issue where customers Vat Reg No have been validated with the "Verify VAT Registration No" on the VAT Registration Log on the customer card.
If they have entered the Country/Region Code and VAT Registration No. with the same prefix.
Eg: BE for Country and BExxxxxxxxx
It validates as a valid Vat Reg No.

The problem arrives when i run the "Sugges Lines" on the page 4812 "Intrastat Report".
It calculates the Vat Reg No as
BEBExxxxxxxxx on the lines because of my enum setting in the InfraStatReportSetup (IntrastatReportSetup."Company VAT No. on File"::"EU Country Code + VAT Reg. No")

Therefore it generates invalid Intrastat Lines in the table: Intrastat Report Line (4812) on the field: Partner VAT ID.
(Duplicate Country Code).

Alternatives Evaluated:
Subscribing to OnAfterInsertEvent on table "Intrastat Report Line" feels like a workaround because you are modifying persisted data instead of catching the "errors" before.

Justification for IsHandled:
Standard logic ends with exit(CountryCode + VATRegNo). An event without IsHandled would not allow me to exit the code before introducing the buggy concatenation of duplicate countrycodes.

Performance Considerations:
The action "Suggest Lines" is something you run pretty rarely and the subscriber logic would be a simple string operation with the O-notation of O(1).

Data Sensitivity Review:
VatRegs are public stuff and it doesn't modify what is already exposed, so it is not a concern here.

Multi-Extension Interaction:
Unlikely to be targeted by more than one extension. You could create another event without isHandled called OnAfterGetVATRegNo for more flexibility if you as a partner needs to do something that doesn't need to exit the standard flow.

Describe the request

[IntegrationEvent(false, false)] local procedure OnBeforeGetVATRegNo(CountryCode: Code[10]; VATRegNo: Text[20]; VATRegNoType: Enum "Intrastat Report VAT File Fmt"; var IsHandled: Boolean) begin //new end;
Internal work item: AB#635857

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an eventext-ready-to-implementReviewed and ready to implement and create PR

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions