Microsoft has released native embedding of Canvas Apps into Dynamics 365 forms. I believe this will change the way we implement solution for clients. It will allow bringing together of more data sources to the user via Microsoft Flow. The release is slowing rolling out the regions which includes Australia, Canada, India, or Japan as of December 2018. Most regions will have the functionality in January.
The link to the recent post is here: https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/embed-canvas-app-in-form
To utilise the new feature in Dynamics 365 simply add a field or subgrid to the form. Via the change properties, under the controls tab a new Canvas App control is available.
I recently spun up a trial to check out the new feature and played around creating a simple embedded canvas app on the contact form.
Configuring the App
I wanted to display a list of documents to the user by passing the context of the contact record to the Canvas app. Using Microsoft Flow query for a list of documents from SharePoint and display on the main form in Dynamics 365.
The functionality supports both Fields and SubGrids which allows for passing of a single record or a list of records to the Canvas App.
To start the process I created a new custom field called SharePoint Docs and added to a section called Documents. I configured the Canvas App control accordingly which will pass the context of the record.
Canvas apps appear to only be available in the web client as both phone and tablet options are grayed out.
Clicking on the Customize button, launches the PowerApps window to edit the new app.
You will notice a new ModelDrivenFormIntegration component is added to the App. This is a collection of records from Dynamics 365 but depending on your scenario the collection may only have one record.
As we are only passing the context of the contact record to the Canvas App you can follow Microsoft’s guide to only get the first record in the collection. Use this syntax First(ModelDrivenFormIntegration.Data).FullName as an example to get the Full Name of the record.
Here is the link if you need help: https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/pass-current-embedded-canvas-app
The ModelDrivenFormIntegration.Data collection allows you to access every field on against the Contact entity which is very useful. I am grabbing the Contact GUID to pass to SharePoint via Microsoft Flow based on the click of a button.
This Flow will query SharePoint to get a list of documents associated to the contact which are displayed to the user via a Gallery. I configured the ability to allow opening or editing of the meta data associated.
The out of the box integration doesn’t allow for meta data editing very easily so I thought I’d try to appeal to Information Architects while also providing a nice user experience. The app is simple but showcases some of the capability that can be achieved using embedded canvas apps.
I will post another article on how to get the list of Documents dynamically into a PowerApp in the coming weeks.
Finally created the post on SharePoint documents: https://the365hero.com/blog/2019/05/29/embedded-canvas-apps-for-sharepoint-documents/