365 business Address Validation
365 business Address Validation checks and completes postal addresses in Microsoft Dynamics 365 Business Central, and offers a type-ahead that fills an address while the user is still typing it.
This page is the entry point for using the app from your own extension. There are three ways to do that, and they solve different problems:
| You want to | Start here |
|---|---|
| Validate an address from your own code - a record of your own, or one the app does not cover | Address Validation API |
| Offer the type-ahead on a page of your own | Address Prediction API |
| Enable the type-ahead for a table of your own | Extensibility Events |
Dependency
Add a dependency to the 365 business Address Validation app in the dependencies node of your app.json:
Code
Which version you need
The bdev.Address Prediction API codeunit has been introduced with 18.9. bdev.Address Validation API has been there from the start.
The public objects
The objects below are the supported surface of the app. Everything else is Access = Internal or an implementation detail that may change without notice, even where AL leaves it public.
| Object | Type | What it is for |
|---|---|---|
bdev.Address Validation API | Codeunit (5523600) | Validate and complete addresses, for the standard tables or for an address of your own. |
bdev.Address Prediction API | Codeunit (5523621) | Drive the type-ahead on a page, and the event that enables it for a table of your own. |
bdev.Address Validation Buffer | Table (5523600), temporary | The address that is sent to the service and the result that comes back, including which fields the service changed. The exchange format of the validation API. |
bdev.Address Autocomplete | Control add-in | The invisible control that carries the type-ahead on a page. |
bdev.Address Prediction Type | Enum (5523601), not extensible | Address looks up postal addresses, Establishment looks up businesses and returns their name, phone number and website as well. |
bdev.Address Data | Table (5523606) | The address data of the tenant that has already been validated. Used by the app to answer a repeated validation without calling the service. |
bdev.Address Validation Setup | Table (5523603) | The setup: whether validation is enabled, for which tables, and in which scope (UI, non-UI or both). |
Two features, two paths
Validation and prediction look similar to a user but are separate features, separately licensed, and reached through separate codeunits:
- Address Validation takes a complete address, sends it to the service and returns the corrected and completed version, with a match score and a field-by-field statement of what was changed. It runs on modify of the supported tables, as a batch, or on demand from your code.
- Address Prediction returns suggestions while the user types and fills the address fields from the selected suggestion. It needs the control add-in on the page and is therefore a UI feature only.
What the app validates by itself
Automatic validation on modify covers Contact, Customer, Vendor, Alternative Address, Order Address, Ship-to Address, Resource, Employee, Sales Header and Purchase Header, each switched on separately in Address Validation Setup.
Your own table is not covered automatically
The app subscribes to the modify triggers of the tables listed above and of no others, and AddressValidationEnabled returns false for every other table id. A table of your own is validated when you call the validation API for it - see Address Validation API.
Expect the service and the license
Both features call a 365 business service over HTTP. A call fails when the feature is not licensed for the tenant - validation and prediction are licensed separately - or when outgoing HTTP calls are not allowed for the app, which is off by default in a sandbox.
One call is answered without the service: when the address has already been validated on this tenant, the app answers from bdev.Address Data and returns the address unchanged.
See also
- Address Validation API
- Address Prediction API
- Extensibility Events
- Documentation - 365 business Address Validation
