---
id: object/codeunit/249
type: object
title: Codeunit 249 "VAT Registration Log Mgt."
summary: Codeunit 249 "VAT Registration Log Mgt." in Base Application (Microsoft.Finance.VAT.Registration). 20 public procedures, 9 events, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC25, BC30.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "30"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: e163f0c7ec665f16285564ee86eb30ba70dfe0c81c576490ce20c2127d9835df
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/VAT/Registration/VATRegistrationLogMgt.Codeunit.al
    title: src/Layers/W1/BaseApp/Finance/VAT/Registration/VATRegistrationLogMgt.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/11657
    - change/bcapps/11435
object_type: codeunit
object_id: 249
name: VAT Registration Log Mgt.
namespace: Microsoft.Finance.VAT.Registration
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "25"
  - "30"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 37
  events: 9
  subscribers: 1
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
  calls: 5
  called_by: 7
  implements: 0
---

# Codeunit 249 "VAT Registration Log Mgt."

> Codeunit 249 "VAT Registration Log Mgt." in Base Application (Microsoft.Finance.VAT.Registration). 20 public procedures, 9 events, 1 event subscribers. Present since at least BC23, still in BC30, changed in BC25, BC30.

Base Application · Microsoft.Finance.VAT.Registration · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/VAT/Registration/VATRegistrationLogMgt.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Permissions | TableData "VAT Registration Log" = rimd |

## Events published

- `OnAfterInsertVATRegistrationLog(var VATRegistrationLog: Record "VAT Registration Log")` (integration): Integration event raised after creating VAT registration log entry.
- `OnAssistEditContactVATRegOnBeforeRunPageVATRegistrationLog(var VATRegistrationLog: Record "VAT Registration Log"; Contact: Record Contact)` (integration): Integration event raised before opening VAT registration log page for contact.
- `OnAssistEditCustomerVATRegOnBeforeRunPageVATRegistrationLog(var VATRegistrationLog: Record "VAT Registration Log"; Customer: Record Customer)` (integration): Integration event raised before opening VAT registration log page for customer.
- `OnAssistEditVendorVATRegOnBeforeRunPageVATRegistrationLog(var VATRegistrationLog: Record "VAT Registration Log"; Vendor: Record Vendor)` (integration): Integration event raised before displaying VAT registration log page for vendor VAT assist edit operations.
- `OnBeforeUpdateRecordFromVATRegLog(var RecordRef: RecordRef; RecordVariant: Variant; VATRegistrationLog: Record "VAT Registration Log"; var IsHandled: Boolean)` (integration): Integration event raised before updating a record with validated data from VAT registration log.
- `OnBeforeCheckVIESForVATNoField(var RecordRef: RecordRef; var VATRegistrationLog: Record "VAT Registration Log"; RecordVariant: Variant; EntryNo: Code[20]; CountryCode: Code[10]; AccountType: Option; var VATNoFieldName: Text; var IsHandled: Boolean)` (integration): Integration event raised before checking VIES validation for a VAT number field to allow custom field identification.
- `OnBeforeInsertValidLogVerification(var VatRegistrationLog: Record "VAT Registration Log")` (integration): Integration event raised before inserting a valid VAT registration log verification entry.
- `OnBeforeInsertInvalidLogVerification(var VatRegistrationLog: Record "VAT Registration Log")` (integration): Integration event raised before inserting an invalid VAT registration log verification entry.
- `OnBeforeValidateVATRegNoWithVIES(var RecordRef: RecordRef; RecordVariant: Variant; EntryNo: Code[20]; CountryCode: Code[10]; AccountType: Option; var IsHandled: Boolean)` (integration): Integration event raised before validating VAT registration number with VIES service to allow custom validation logic.

## Event subscriptions

- HandleViesRegisterServiceConnection subscribes to Table "Service Connection" OnRegisterServiceConnection

## Procedures

- `LogCustomer(Customer: Record Customer)`: Creates VAT registration log entry for customer and initiates validation if service is enabled.
- `LogVendor(Vendor: Record Vendor)`: Creates VAT registration log entry for vendor and initiates validation if service is enabled.
- `LogContact(Contact: Record Contact)`: Creates VAT registration log entry for contact and initiates validation if service is enabled.
- `LogVerification(var VATRegistrationLog: Record "VAT Registration Log"; XMLDoc: DotNet XmlDocument; Namespace: Text)`
- `DeleteCustomerLog(Customer: Record Customer)`: Deletes all VAT registration log entries associated with the specified customer.
- `DeleteVendorLog(Vendor: Record Vendor)`: Deletes all VAT registration log entries associated with the specified vendor.
- `DeleteContactLog(Contact: Record Contact)`: Deletes all VAT registration log entries associated with the specified contact.
- `AssistEditCustomerVATReg(Customer: Record Customer)`: Opens VAT registration log page for customer with validation and logging capabilities.
- `CheckIfCountryCodeIsSet(Customer: Record Customer)`: Validates that customer has country/region code set when VAT registration service is enabled.
- `AssistEditVendorVATReg(Vendor: Record Vendor)`: Opens VAT registration log page for vendor with validation and logging capabilities.
- `AssistEditContactVATReg(Contact: Record Contact)`: Opens VAT registration log page for contact with validation and logging capabilities.
- `AssistEditCompanyInfoVATReg()`: Opens VAT registration log page for company information with validation and logging capabilities.
- `CheckVIESForVATNo(var RecordRef: RecordRef; var VATRegistrationLog: Record "VAT Registration Log"; RecordVariant: Variant; EntryNo: Code[20]; CountryCode: Code[10]; AccountType: Option)`: Validates VAT registration number against VIES service for EU countries.
- `CheckVIESForVATNoField(var RecordRef: RecordRef; var VATRegistrationLog: Record "VAT Registration Log"; RecordVariant: Variant; EntryNo: Code[20]; CountryCode: Code[10]; AccountType: Option; VATNoFieldName: Text)`: Validates VAT registration number against VIES service for EU countries with custom field name.
- `UpdateRecordFromVATRegLog(var RecordRef: RecordRef; RecordVariant: Variant; VATRegistrationLog: Record "VAT Registration Log")`: Updates business entity record with validated VAT registration information from VIES response.
- `InitServiceSetup()`: Initializes VAT registration number service configuration with default settings.
- `SetupService()`: Opens configuration page for VAT registration number service setup.
- `EnableService()`: Enables VAT registration number validation service if not already configured.
- `ValidateVATRegNoWithVIES(var RecordRef: RecordRef; RecordVariant: Variant; EntryNo: Code[20]; AccountType: Option; CountryCode: Code[10])`: Validates VAT registration number with VIES service and displays validation results.
- `GetServiceDisclaimerUR(): Text`: Returns URL for VAT registration service disclaimer information.

Plus 7 local procedures.

## Triggers

OnRun

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Page 249 "VAT Registration Log"](../page/249.md) (4 calls: `AssistEditCompanyInfoVATReg → (object)`, `AssistEditContactVATReg → (object)`, `AssistEditCustomerVATReg → (object)`, …)
- [Codeunit 701 "Data Type Management"](../codeunit/701.md) (3 calls: `CheckVIESForVATNoField → FindFieldByName`, `CheckVIESForVATNoField → GetRecordRef`, `UpdateRecordFromVATRegLog → GetRecordRef`)
- [Codeunit 248 "VAT Lookup Ext. Data Hndl"](../codeunit/248.md) (2 calls: `CheckVIESForVATNoField → (object)`, `InitServiceSetup → GetVATRegNrValidationWebServiceURL`)
- [Codeunit 6224 "XML DOM Management"](../codeunit/6224.md) (2 calls: `ExtractValue → FindNodeWithNamespace`, `LogVerification → FindNodeWithNamespace`)
- [Codeunit 4030 "Client Type Management"](../codeunit/4030.md) (1 call: `IsAPIClientType → GetCurrentClientType`)

## Called by

- [Table 18 "Customer"](../table/18.md) (3 calls: `OnDelete → DeleteCustomerLog`, `VATRegistrationValidation → LogCustomer`, `VATRegistrationValidation → ValidateVATRegNoWithVIES`)
- [Table 23 "Vendor"](../table/23.md) (3 calls: `OnDelete → DeleteVendorLog`, `VATRegistrationValidation → LogVendor`, `VATRegistrationValidation → ValidateVATRegNoWithVIES`)
- [Table 5050 "Contact"](../table/5050.md) (3 calls: `OnDelete → DeleteContactLog`, `VATRegistrationValidation → LogContact`, `VATRegistrationValidation → ValidateVATRegNoWithVIES`)
- [Codeunit 5055 "CustVendBank-Update"](../codeunit/5055.md) (2 calls: `UpdateCustomer → LogCustomer`, `UpdateVendor → LogVendor`)
- [Table 213 "Alt. Cust. VAT Reg."](../table/213.md) (2 calls: `VATRegistrationValidation → LogCustomer`, `VATRegistrationValidation → ValidateVATRegNoWithVIES`)
- [Codeunit 2 "Company-Initialize"](../codeunit/2.md) (1 call: `OnRun → InitServiceSetup`)
- [Codeunit 248 "VAT Lookup Ext. Data Hndl"](../codeunit/248.md) (1 call: `InsertLogEntry → LogVerification`)

## Recent changes

- 2026-09-21 [#11657 Fix VIES integrity check: tolerate country-code prefix on echoed VAT number (uptake fix)](../../changes/bcapps/11657.md) (main, BC30, fix)
- 2026-09-18 [#11435 Validate unauthenticated public API responses before use](../../changes/bcapps/11435.md) (main, BC30, fix)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC25, BC30

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "VAT Registration Log Mgt.")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
