Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Dynamics CE Embedded Canvas App Gallery Control Filter

(0) ShareShare
ReportReport
Posted on by 4

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.

  • Power Platform Communities Profile Picture
    4 on at
    RE: Dynamics CE Embedded Canvas App Gallery Control Filter

    I solved it. I needed to retrieve the full record for the entity on the form and then retrieve the GUID of the lookup field from there.

    I set a variable like this:

    Set(varname,LookUp('form entity name', formentityprimaryidentifiername = ModelDrivenFormIntegration.Item.formentityprimaryidentifiername).contactlookupfield.contactid);

    Then I use the variable in the Filter like this:

     Filter(Addresses, If(IsType(Addresses[@'Parent'], [@Contacts] ), AsType(Addresses[@'Parent'], [@Contacts]).contactid = varname))


    I found the answer on this post: https://medium.com/hitachisolutions-braintrust/overcoming-top-5-challenges-with-embedded-canvas-apps-f5698b32a7b5

    The relevant piece was:

    1. Challenge #1: The ModelDrivenFormIntegration control does not fetch values for fields of related entities. For example, the following will not work to get the list of contacts for an account (when the control is connected to the accounts entity):

    ModelDrivenFormIntegration.Item.Contacts

     

    Trick #1: The ModelDrivenFormIntegration control should only be used to obtain the GUID of the contextual record. The CDS connector, along with Lookup, should be used to obtain the complete record.

  • Power Platform Communities Profile Picture
    4 on at
    RE: Dynamics CE Embedded Canvas App Gallery Control Filter

    Here's an update on this. The Parent property of the customeraddress entity is not the problem with the Gallery filter. I have it working when I hard-code a GUID for a Contact like this example:

     

    Filter(Addresses, If(IsType(Addresses[@'Parent'], [@Contacts] ),

    AsType(Addresses[@'Parent'], [@Contacts]).contactid

     = GUID("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")))

     

    The problem is when I try to retrieve the Contact GUID from a Contact lookup field on the Dynamics CE form where the Canvas App is embedded. 

     

    Filter(Addresses, If(IsType(Addresses[@'Parent'], [@Contacts] ),

    AsType(Addresses[@'Parent'], [@Contacts]).contactid

     = ModelDrivenFormIntegration.Item.'contactlookupfieldname'.contactid))

     

    I've tried many variations including trying to place the Contact GUID in a global variable and then using the variable in the Filter.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Adis Profile Picture

Adis 136 Super User 2025 Season 1

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 81

#3
Jonas "Jones" Melgaard Profile Picture

Jonas "Jones" Melgaard 77 Super User 2025 Season 1

Product updates

Dynamics 365 release plans