Welcome to Cognettacloud

9x Microsoft Business Solutions 365 MVP, I'm the CTIO for congruentX and a community Technology Evangelist Delivering Edge Experiences Using Microsoft Dynamics 365, Azure & Power Platform (Power BI, PowerApps & Power Automate) & Office 365

PowerApps: Account and Contacts via a Gallery View, Avoiding Polymorphic Error

While working on a Power App Concept, I came across the need to show all the contacts that where related to an account. I was using an Account gallery to display a list of Accounts, then I was trying to filter a second gallery of items contain contacts using the ID GUID from the parent account matching it off to the contact’s parent account ID.  I kept getting the error message field types don’t match or the are not polymorphic.  This was a big challenge using the Dynamics 365 connector. However, switching to the Common App Connector, there’s special built in functionality to handle this relationship.

The command is Galleryname.Selected.Contacts – to my knowledge this does not work in the Dynamics 365 Connector and is one of the benefits of using the other connectors. See my other blog post on why to move to the Dynamics 365 Connector.

To test, I created a blank app, added gallery 1 (account) and gallery 3 (contacts) from the Common App Connector.

Now you can see when I click on the left gallery 1 for accounts, the contacts in gallery 3 are filtered by the gallery 1 account selection by the user! I am posting this very simply resolution so that someone looking to do the same simply connection can avoid the struggles above. Most of the posts talk about using type and dealing with polymorphic relationship, not very citizen developer friendly! Enjoy.