The Canada Post sample app is a ready-to-import example of Address Validation for Dataverse configured with Canada Post. It shows the Canada Post AddressComplete control on Account and Contact forms, including the extra details Canada Post returns: PO Box, building number, street name, address type and data level. Canada Post does not offer background verification, so this sample has no flows. Use it to try Canada Post in a few minutes, and as a reference when you configure your own forms.
The sample contains no API keys: you bring your own key, and the sample's Setup page stores it in your environment. Download it from the SharpXRM sample apps repository on GitHub.
What the sample contains
| Component | Details |
|---|---|
| Solution | SharpXrmSampleCanadaPost, publisher SharpXRM Samples (prefix sxs) |
| App | Canada Post Address Sample: a model-driven app with a Setup page, Accounts and Contacts |
| Forms | Account and Contact main forms and quick create forms with the Sharp XRM - Canada Post Autocomplete control on the address search box, the standard address columns it fills, and a column for every extra output of the control |
| Columns | Sample columns named sxs_cp_* on Account and Contact, so samples never collide with each other or with your own columns |
| Setup page | Saves your key in the API Configuration SharpXrmSample_CanadaPost, validates it and shows your license status |
Before you start
- Address Validation for Dataverse installed and licensed in the environment. A trial license works, but it must cover Canada Post. See Download and Install Address Validation for Dataverse.
- A System Administrator or System Customizer to import the solution, and a System Administrator or SharpXRM - Address Validation Administrator to run the Setup page.
- A Canada Post AddressComplete key (see step 1).
Step 1: Get your Canada Post key
- Get an AddressComplete key from Canada Post, or contact support@sharpxrm.com. The key looks like
AA11-AA11-AA11-AA11. - In your AddressComplete account, add your Dynamics 365 address (for example
https://yourorg.crm.dynamics.com) to the key's allowed URLs.
For more details, see Setup your Canada Post Autocomplete Key.
Step 2: Install the sample
- Download the managed solution: SharpXrmSampleCanadaPost_1_0_0_0_managed.zip. To change the sample (for example the forms or the control settings), use the unmanaged solution instead: SharpXrmSampleCanadaPost_1_0_0_0.zip.
- In the Power Apps Maker Portal, select your environment, then go to Solutions > Import solution and import the zip file.
Step 3: Configure the sample
- Open the Canada Post Address Sample app. It opens on the Setup page, which shows the status of Address Validation, your license, the API configuration.
- In 1. Enter your API key, enter your Canada Post AddressComplete key and select Save and validate. The page creates or updates the API Configuration SharpXrmSample_CanadaPost and checks the key with Canada Post.
- Check that the status lines are green. If a form was already open, refresh the browser tab (F5): the controls keep their configuration in the browser.
Step 4: Test address autocomplete
- On the Setup page, select New sample account or New sample contact. Quick create account and Quick create contact open the same control on the quick create forms, which + New also uses in the app.
- Start typing a street address in Address search and pick a suggestion. Try: 111 Wellington St, Ottawa
- The standard address columns and the provider's extra outputs fill in. Save the record to keep them.
The sample forms do not use an Address Control Setting, so suggestions are limited to 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 (use the unmanaged solution to change the sample forms). See Configure Canada Post Autocomplete on Dataverse Forms.
What the forms show
| Control output | Column on Account and Contact | Type |
|---|---|---|
street | Street 1 (address1_line1) | Standard column |
unitNumber | Street 2 (address1_line2) | Standard column |
city | City (address1_city) | Standard column |
county | County (address1_county) | Standard column |
state | State/Province (address1_stateorprovince) | Standard column |
zip | ZIP/Postal Code (address1_postalcode) | Standard column |
country | Country/Region (address1_country) | Standard column |
latitude | Latitude (address1_latitude) | Standard column |
longitude | Longitude (address1_longitude) | Standard column |
fullAddress | Full Address (sxs_cp_fulladdress) | Sample column |
POBoxNumber | PO Box Number (sxs_cp_poboxnumber) | Sample column |
streetnumber | Building Number (sxs_cp_buildingnumber) | Sample column |
streetname | Street Name (sxs_cp_streetname) | Sample column |
addresstype | Address Type (sxs_cp_addresstype) | Sample column |
datalevel | Data Level (sxs_cp_datalevel) | Sample column |
Use the sample with other users
- Share the Canada Post Address Sample app with their security role (Power Apps > Apps > ... > Share).
- Make sure their roles can read Accounts and Contacts, and give them the SharpXRM - Address Validation User role so the control can read its configuration. See Assign privileges for users.
Remove the sample
Delete the SharpXrmSampleCanadaPost solution from Solutions. This removes the app, forms, Setup page, columns. The API Configuration records the Setup page created are kept; delete them from the Address Validation for Power Apps app if you no longer need them. Several samples can be installed side by side.
Troubleshooting
| What you see | What to do |
|---|---|
| Setup page: Address Validation for D365 is not installed | Install Address Validation for Dataverse first, then reopen the app. |
| Setup page: license message | Open the Address Validation for Power Apps app to start a trial or activate your license. The license must cover Canada Post. |
| Setup page: saved, but it could not be validated | Check the key and the notes shown on the page. |
| The form shows the address box but no suggestions | Refresh the browser tab (F5) so the control reloads its configuration. |
| The control shows a license message instead of the address box | The license is missing, expired, or does not include Canada Post. |
| N | o |
| A | d |