Configure Canada Post Autocomplete on Dataverse Forms

Canada Post - Configuration

This article explains how to add the Sharp XRM Canada Post Autocomplete control to a Microsoft Dataverse model-driven form. These steps must be done by an administrator or a user with system customization privileges.

Configure Canada Post Autocomplete on a model-driven form

To keep the example simple, we use the Account table and its Address 1 columns. The configuration is the same for other tables and columns, standard or custom.

Before you start, create an API Configuration record for Canada Post (see Set up your Canada Post Autocomplete key).

  1. In the Power Apps Maker Portal, select the environment where Address Validation for Dataverse is installed. Go to Tables > Account > Forms (or open the table from your solution) and open the main form you want to use.
  2. In the form designer, select the Address 1: Street 1 column. You can also find it with Tree view. In the properties pane, select Hide label.
  3. In the properties pane, expand Components and select + Component.

    Column properties pane with Hide label and the Components section

  4. In Add component, select Sharp XRM - Canada Post Autocomplete. If it isn't listed, select Get more components, add the control, and then select it.

    Add component dialog

  5. Configure the control properties described in the table below. For API Configuration Name and Advanced Settings ID, enter a static value. For each address property, select the table column where the value should be stored.

    Canada Post Autocomplete properties

  6. Under Show component on, select where the control should be used (Web, Mobile, Tablet) and select Done.

    Show component on options and Done button

  7. Select Save and publish, then open an account record to test the control.

Control properties

PropertyDescriptionValue type
API Configuration Name *The unique name of your Canada Post API Configuration record.Static value
Advanced Settings IDIf you use Address Control Settings, the Identifier of your setting record.Static value
Configuration Cache HoursOptional. Leave empty. Current versions of the control manage the browser cache automatically and show this property as deprecated.Static value
Street Address *Column to store the street address (number and street name). This is the column the control is placed on.Single line of text
Sub Building NumberColumn to store the unit, suite or apartment number, when available.Single line of text
City *Column to store the city.Single line of text
State or Province *Column to store the state or province.Single line of text
Zip / Postal codeColumn to store the postal code.Single line of text
PO Box NumberColumn to store the PO Box number, for PO Box addresses.Single line of text
Country *Column to store the country.Single line of text
CountyColumn to store the county, when returned.Single line of text
Full addressOptional column for the complete formatted address.Single line of text
Building NumberColumn to store the building number only (for 123 Main St., returns 123).Single line of text
Street NameColumn to store the street name only (for 123 Main St., returns Main St.).Single line of text
Address TypeColumn to store whether the address is Residential, Commercial or other.Single line of text
Data LevelColumn to store the match level: Unknown, Premise, RangedPremise, Street or City.Single line of text
Latitude / LongitudeNot returned by Canada Post Autocomplete. Leave empty.Floating point number
Display Address Fields (deprecated)No longer used. Leave it set to No and add the individual address columns to the form.Yes / No

* Required.

Working with Advanced Settings

Country search: by default, the Canada Post control only suggests Canadian addresses. To search other countries, create an Address Control Setting with Enable World set to Yes and enter its Identifier in the control's Advanced Settings ID property.

Address Control Settings let administrators control the format of returned values and whether addresses outside Canada can be returned.

  1. In the Address Validation for Power Apps app, go to Settings > Address Control Settings and select + New.

    Address Control Settings list

  2. Enter a unique Identifier. This is the value you enter in the control's Advanced Settings ID property.
  3. Set API Type to Canada Post and choose the parameters below.
ParameterPossible valuesDescription
State NameUse Short State Name / Use Long State NameFor example, QC or Quebec.
Country DisplayUse ISO2 Country Code / Use ISO3 Country Code / Use Long Country NameFor example, CA, CAN or Canada.
Enable WorldYes / NoWhen set to Yes, suggestions can come from any country: the search starts from the record's country (or the default country of the API Configuration), and users can switch country with the Change Country option at the bottom of the suggestion list. When set to No (or when no setting is used), suggestions are limited to Canadian addresses.

Canada Post Address Control Settings record

Note: Address Control Settings are cached in each user's browser and refresh automatically when the cached copy expires. To apply a change immediately, users can clear their browser cache.

Assign the required security privileges to users

After configuration, assign the required security roles to users so they can use the autocomplete controls. See Assign privileges for users.

Was this article helpful?