Address Data API
Table 5523606 bdev.Address Data is the tenant's directory of addresses already validated or confirmed by a user.
It answers a repeated validation without a service call, and it publishes a small set of procedures another extension can call directly.
Code
A table, not a codeunit
These procedures are instance methods on the bdev.Address Data record variable itself, not on a separate API codeunit. Most of them read or change the row the variable is currently positioned on.
Fields
| Field | Type | Description |
|---|---|---|
Address | Text[100] | Street and house number. Part of the primary key, not editable after insert. |
Address 2 | Text[50] | Additional address information. Part of the primary key. |
Post Code | Code[20] | Part of the primary key. |
City | Text[30] | Part of the primary key. |
County | Text[30] | Part of the primary key. |
Country/Region Code | Code[10] | Part of the primary key. |
Address Validation Status | Option | Not Validated, Manually Checked or Validated. See Status. |
Last Date Validated | Date | Set automatically whenever the status changes to anything other than Not Validated. |
Usage | Integer (FlowField) | How many source records currently point at this address. |
The six address fields together form the primary key, so two rows with the same address never exist. Changing any of them resets Address Validation Status to Not Validated.
Status
Code
A row starts as Not Validated on insert. It becomes Validated when the validation service has confirmed it and Manually Checked when a user confirms it by hand on the Address Data page. Both count as validated for IsValidated and IsKnownAddress.
IsValidated()
Four overloads answer whether an address is already validated, without calling the service.
Code
| Parameter | Type | Description |
|---|---|---|
| (none) | Checks the status of the row Rec is currently positioned on. | |
addressBuffer | Record "bdev.Address Validation Buffer" temporary | Looks up the row with this address and checks its status. false when no such row exists. |
recordVariant | Variant | A record of one of the tables the app supports (see Address Validation API). The app builds the address from it first. |
addressOptionOrdinal | Integer | Which address on the record to use, for a table that carries more than one (for example a sales document's sell-to, ship-to and bill-to addresses). |
Returns true when the matching row has status Manually Checked or Validated.
IsKnownAddress(Record)
Code
| Parameter | Type | Description |
|---|---|---|
addressBuffer | Record "bdev.Address Validation Buffer" temporary | The address to look up. On a match, Rec is positioned on the found row and addressBuffer is filled with its values. |
Returns true when the address is already known and validated. This is the lookup the app itself runs before calling the service: a hit here means the address does not need to go to the service again.
AddOrUpdate(...)
Inserts the address if it is not yet known, or finds the existing row, and records that source uses it. Four overloads, depending on whether the address comes from a validation buffer or from the dictionary Address Prediction API returns, and on whether the source record carries more than one address.
Code
| Parameter | Type | Description |
|---|---|---|
addressBuffer | Record "bdev.Address Validation Buffer" temporary, or Dictionary of [Text, Text] | The address to add or update. An address with neither Address, Address 2, Post Code nor City filled is ignored. |
source | Variant | The record that uses this address, for the Usage count. Pass a record of bdev.Address Data itself to skip the usage link. |
addressOptionOrdinal | Integer | Which address on source this is, for a table with more than one. Omit it, or pass -1, for a table with a single address. |
This call does not validate the address and does not change its status - it only makes sure the address exists in the directory and is linked to source. Call SetValidatedManually afterwards if you know by other means that the address is correct.
SetValidatedManually()
Code
Sets the status of the row Rec is positioned on to Manually Checked and saves it. Use this after AddOrUpdate when your own process has already confirmed the address is correct and a service call is not needed.
ResetValidation()
Code
Sets the status of the row Rec is positioned on back to Not Validated and saves it. The next automatic or manual validation then calls the service again instead of answering from the directory.
Example
Code
AddOrUpdate does not validate
AddOrUpdate only records that an address exists and who uses it. If the address has not gone through Address Validation API and you have not called SetValidatedManually, its status stays Not Validated and IsValidated/IsKnownAddress answer accordingly.
See also
- 365 business Address Validation - Overview
- Address Validation API
- Checking orders from an external system
- Documentation - 365 business Address Validation
