/

Build a Dataverse Contacts Gallery Related to Dynamics 365 Accounts: Series 2

Dataverse Accounts gallery screenshot

This screen lists people stored in Dataverse and lets a seller narrow the gallery to contacts associated with a selected Dynamics 365 Account.

1. Add Contact and Account data sources

Add the standard Contacts and Accounts tables from the same Dataverse environment. Create an account selector gallery or combo box and a contacts gallery. Use the actual names shown in the app data pane.

2. Select an account

// Accounts gallery OnSelect
Set(varSelectedAccount, ThisItem)

3. Filter contacts by parent account

For a Dataverse lookup column, compare the lookup record with the selected Account record. In many canvas apps the relationship column is exposed as Parent Customer or a generated identifier based on the schema. Use IntelliSense to insert the correct field:

Filter(
    Contacts,
    'Parent Customer' = varSelectedAccount
)

The exact lookup display name and record type depend on your environment. If Power Apps reports incompatible types, inspect the lookup field’s generated schema and compare like-for-like Dataverse records; do not compare the lookup to the account name text.

4. Add a name search

Filter(
    Contacts,
    'Parent Customer' = varSelectedAccount &&
    StartsWith('Full Name', txtContactSearch.Text)
)

Check delegation warnings for the complete formula and verify StartsWith support for the selected column. Test with a large contact table and confirm the expected results in Dataverse.