Canada Post Sample App: Install, Configure and Test

Canada Post - Configuration

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

ComponentDetails
SolutionSharpXrmSampleCanadaPost, publisher SharpXRM Samples (prefix sxs)
AppCanada Post Address Sample: a model-driven app with a Setup page, Accounts and Contacts
FormsAccount 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
ColumnsSample columns named sxs_cp_* on Account and Contact, so samples never collide with each other or with your own columns
Setup pageSaves 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

  1. Get an AddressComplete key from Canada Post, or contact support@sharpxrm.com. The key looks like AA11-AA11-AA11-AA11.
  2. 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

  1. 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.
  2. 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

  1. 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.
  2. 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.
  3. 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

  1. 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.
  2. Start typing a street address in Address search and pick a suggestion. Try: 111 Wellington St, Ottawa
  3. 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 outputColumn on Account and ContactType
streetStreet 1 (address1_line1)Standard column
unitNumberStreet 2 (address1_line2)Standard column
cityCity (address1_city)Standard column
countyCounty (address1_county)Standard column
stateState/Province (address1_stateorprovince)Standard column
zipZIP/Postal Code (address1_postalcode)Standard column
countryCountry/Region (address1_country)Standard column
latitudeLatitude (address1_latitude)Standard column
longitudeLongitude (address1_longitude)Standard column
fullAddressFull Address (sxs_cp_fulladdress)Sample column
POBoxNumberPO Box Number (sxs_cp_poboxnumber)Sample column
streetnumberBuilding Number (sxs_cp_buildingnumber)Sample column
streetnameStreet Name (sxs_cp_streetname)Sample column
addresstypeAddress Type (sxs_cp_addresstype)Sample column
datalevelData Level (sxs_cp_datalevel)Sample column

Use the sample with other users

  1. Share the Canada Post Address Sample app with their security role (Power Apps > Apps > ... > Share).
  2. 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 seeWhat to do
Setup page: Address Validation for D365 is not installedInstall Address Validation for Dataverse first, then reopen the app.
Setup page: license messageOpen 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 validatedCheck the key and the notes shown on the page.
The form shows the address box but no suggestionsRefresh the browser tab (F5) so the control reloads its configuration.
The control shows a license message instead of the address boxThe license is missing, expired, or does not include Canada Post.
No
Ad

Was this article helpful?