The PostGrid sample app is a ready-to-import example of Address Validation for Dataverse configured with PostGrid. It shows the PostGrid autocomplete control on Account and Contact forms, and two Power Automate flows that check each address with PostGrid Address Verification (US and Canada) or International Address Verification (other countries). Use it to try PostGrid 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 | SharpXrmSamplePostGrid, publisher SharpXRM Samples (prefix sxs) |
| App | PostGrid 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 - PostGrid 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_pg_* 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_PostGrid, validates it and shows your license status |
| Power Automate flows | Verify account address with PostGrid (sample) and Verify contact address with PostGrid (sample), which verify each new or changed address with PostGrid Address Verification (US and Canada) and International Address Verification (other countries), write the verified address back and add a note |
| Connection reference | PostGrid sample - Dataverse (Microsoft Dataverse), used by the flows |
Before you start
- Address Validation for Dataverse installed and licensed in the environment. A trial license works, but it must cover PostGrid. See Download and Install Address Validation for Dataverse.
- An Address Validation license that includes the PostGrid add-on.
- 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 PostGrid public API key (see step 1).
Step 1: Get your PostGrid key
- Sign in to your PostGrid Address Verification dashboard and copy your public key (
live_pk_ortest_pk_) for the autocomplete control. - Add your Dynamics 365 address (for example
https://yourorg.crm.dynamics.com) to the public key's allowed origins. - Also copy your secret key (
live_sk_ortest_sk_) for the verification flows. Test keys use no lookups but return sample data. See - Set up your PostGrid API Keys
- .
For more details, see Set up your PostGrid API Keys.
Step 2: Install the sample
- Download the managed solution: SharpXrmSamplePostGrid_1_0_0_0_managed.zip. To change the sample (for example the forms or the control settings), use the unmanaged solution instead: SharpXrmSamplePostGrid_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.
- When asked for the connection reference PostGrid sample - Dataverse, select or create a Microsoft Dataverse connection. The flows are turned on when the import completes.
Step 3: Configure the sample
- Open the PostGrid Address Sample app. It opens on the Setup page, which shows the status of Address Validation, your license, the API configuration and the verification flows.
- In 1. Enter your API key, enter your PostGrid public API key and select Save and validate. The page creates or updates the API Configuration SharpXrmSample_PostGrid and checks the key with PostGrid.
- In 2. Background verification, enter the PostGrid secret key (
live_sk_). It is stored in the API Configuration SharpXrmSample_PostGrid_Verify. Select Save and validate. - 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: 1 E 161st St, Bronx
- The standard address columns and the provider's extra outputs fill in. Save the record to keep them.
The control on the sample forms is limited to the United States and Canada (Display Countries = US,CA) and opens with the United States selected. Clear Display Countries in the unmanaged solution to search international addresses.
Step 5: Test background verification
A few seconds after you save a record, the sample flow for that table:
- verifies the address with PostGrid Address Verification (US and Canada) and International Address Verification (other countries) (action
sharpxrm_VerifyWithPostGrid / sharpxrm_VerifyWithPostGridInternational) through the Microsoft Dataverse connector, - writes the verified address back to the standard address columns (street, unit, city, county, state, ZIP or postal code, country, latitude and longitude),
- adds a note with every value returned, the address that was sent, what was written back and the full response.
Refresh the form to see the note in the Notes section. While a check is running, the Last Verified Address sample column reads PENDING.
The flows use the PostGrid secret key from step 2 of the Setup page. Each address change uses one PostGrid lookup.
The flows only act on records whose address was picked with this sample's control (the sample Full Address column is filled), so they never change your other Accounts and Contacts. They also skip their own updates. Use them as a starting point for your own flows; see the related articles below.
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 |
state | State/Province (address1_stateorprovince) | Standard column |
zip | ZIP/Postal Code (address1_postalcode) | Standard column |
country | Country/Region (address1_country) | Standard column |
fullAddress | Full Address (sxs_pg_fulladdress) | Sample column |
company | Company (sxs_pg_company) | Sample column |
(verification flows) | Last Verified Address (sxs_pg_verifiedaddress) | Sample column |
Use the sample with other users
- Share the PostGrid 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 SharpXrmSamplePostGrid solution from Solutions. This removes the app, forms, Setup page, columns and flows. 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 PostGrid. |
| 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 PostGrid. |
| No note appears after saving | Check the Verification flows line on the Setup page: the flows must be on and their connection set. The flows only act when the address was picked with the sample's control. Open the flow in Power Automate to see its run history. |
| A note says Address verification failed | The note includes the details. Usually the verification key is missing or invalid (run the Setup page again), or the license does not cover the provider. |
| The control reports an origin or access error | The control needs the public key, and your Dynamics 365 address must be in its allowed origins. |
| A verification note says PostGrid rejected the key because of its allowed-origins restriction | Enter the secret key (live_sk_) in step 2 of the Setup page. |