I'm wondering if this is a limitation with the customeraddress entity in Dynamics CRM (CE). I have an embedded Canvas App on a form in CRM and there is a Gallery control to display "Addresses" (the customeraddress entity). My requirement is simple: I want to display addresses for a particular Contact. I can successfully get it to filter the Gallery based on a comparison between a custom field on the Addresses entity and a custom field on the form, or with hard coded values. What won't work for me is filtering based on the "Parent" attribute of Addresses. When the Gallery renders on the form, it appears to be searching but is blank and no addresses are displayed.
The Parent attribute is a polymorphic lookup field that can contain an entity reference to a Contact or Account. The field I am comparing it to that lives on the form is a lookup field to the Contact entity. The formula I have in place for the Items property of the Gallery control is:
Filter(Addresses, If(IsType('Parent', [@Contacts] ),
AsType('Parent', [@Contacts]).Contact) = ModelDrivenFormIntegration.Item.'contactlookupfieldname'.Contact)
The fields in the formula were chosen with Intellisense so I know that the app is aware of the form context and the available attributes on Addresses. And because I was able to get filtering to work with a different field, I think I have it narrowed down to something with the Parent attribute. This formula passes the app checker but there is a warning about Delegation. I've seen other examples of Gallery controls working even with the Delegation warning.
I hope this is not a limitation of embedded PowerApps. Thanks in advance for any ideas or solutions.