Hey Andy I found an interesting article that might help:https://dynamicsninja.blog/2018/12/26/embedded-canvas-apps-dynamic-d365-context/In his example he calls a function to actually get the GUID of the record you want to reference and then later references it when he goes to filter the gallery.Not sure if this is exactly what needs to happen but might be worth a shot.
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] ),
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.
I've tried many variations including trying to place the Contact GUID in a global variable and then using the variable in the Filter. I found a post that appears to describe the same problem, but I can't get the proposed solution to work. The title of the post is "Embedded canvas app ModelDrivenFormIntegration.Item.[Lookupfield] always returns emtpy". https://powerusers.microsoft.com/t5/Common-Data-Service-for-Apps/Embedded-canvas-app-ModelDrivenFormIntegration-Item-Lookupfield/m-p/333802#M2180
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:
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.
If you've found this thread useful, dive deeper into User Group community content by role