- I've tried to see if I can write to the PowerAppsHost "EntityId" property programmatically via an event, which seems to be possible. I've not been able to test if I get the value into the Power App, but I have some reservations when it comes to this way of doing it. I'm afraid that there will be something else writing to this property later, or I feel this way of doing it is a bit dirty somehow. I would not expect it to work, but it's just a feeling I have.
- I found this article describing creating an extension or duplicate of the PowerAppsHost control: https://www.linkedin.com/pulse/expand-dynamics-foscm-power-apps-integration-oleksandr-dudarenko . I guess this is an option, but then it becomes pretty complicated and I'd rather not maintain it. This is part of the reason we want to use the Power App in the first place.
- I can extend a table with a new field where I programmatically write the value I need to pass to the Power App, but I am not sure when or how to write to the field and if I can keep it updated. It seems like a workaround that I am not sure is feasible. I would like to avoid it if I can.
- I've found what seems to be official documentation of the Power Apps Host control here: https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/user-interface/powerapps-host-control . On item 4 under "Host an app from Power Apps on a page" they describe using a "DataMethod". It's not entirely clear to me what they mean by this, but I suppose it similar to a display method. I've tried to use a method in the property "Entity ID Method", but I always end up with an error saying that the method cannot be found on the data source. I've tried using my own table as a data source, but mainly I want to extend some standard tables like CustTable. I've tried that as well, but with the same error. I am not sure if the method must be on the configured data source. It would be better if it didn't have to be. Experimenting with this eventually caused a problem crashing IIS Express with an exception "Attempted to read or write protected memory", which I spent several hours to get rid of.