Power Apps Component Framework with Offline Model Driven Apps

Brendon Colburn
4 min readJun 13, 2022

I recently had a hackathon with a customer that was looking to modernize their existing inspection application using Power Platform. The approach we ended up taking was multi-headed, one team worked on doing it in a canvas app, one group was focused on a .NET MAUI implementation with Dataverse on the back end, and I worked on building a PCF Control that was embedded on the form of a Model Driven Application. There were two complexities that we needed to account for in the approach:

  1. The application must be able to synchronize inspection data on a laptop from timeframes where the inspector doesn’t have internet.
  2. The application must be able to render a dynamic questionnaire, something that can scale up to a large use case.

I would define a dynamic questionnaire here as a form that renders a dynamic series of questions and sub-questions based on previously filled out fields and other criteria being met. This isn’t the first time that I had run into this requirement over the years, in the past I’ve recommended approaches using web resources and more recently canvas apps. This time, due to the offline laptop requirement, I felt compelled to explore .NET MAUI and PCF as they had the potential to have a less burdensome synchronization overhead than a pure canvas app driven approach.

What Did I Build / Learn?

Bottom line up front, here’s a link to the repo that has the source code and description of what was built: https://github.com/brendon-colburn/dq-pcf-sample. Please check there for details regarding the current state and ongoing implementation efforts.

Here are the main things I learned in the process:

  • The new Power Apps Windows App has F12 browser debugging tools, you just need to make sure you click on the MDA form to get focus on it before pressing F12.
  • You must follow ALL THE STEPS outlined in this article from Scott Durrow to convert a regular PCF control into a superior virtual PCF control (I took a half a day to figure out I hadn’t updated the control manifest xml to type of virtual which is the first step in the article, lol): https://develop1.net/public/post/2022/04/07/how-to-convert-pcf-to-virtual-control
  • Much to my delight, offline mode through the desktop app has a mock of the Web API so you can use that in the PCF to retrieve records.
  • Somewhat confusingly, if you are retrieving multiple records through the PCF Web Api object you need to be mindful of any lookup columns in the retrieval. If there are any, you will need to add them to the offline MDA profile or else the control will not render and say you don’t have access which can be a bit misleading (but I get it now).
  • When dynamically rendering controls based on a retrieved list of records, the map() function is your friend.
  • There’s a learning curve to building your own controls instead of just leveraging the pre-built Fluent UI controls. I accelerated this by looking at examples made by Microsoft MVP Diana Birkelbach. Here’s her blog: Dianamics.
  • Once you get a solid foundation built, you can start iterating and making big improvements fast in the UI and it’s fun! Being able to have a one-line CLI command for deployment in pac pcf push along with the test harness with hot reload capabilities are the things that really ramp up developer velocity.

Observations / Recommendations

What I’ve built so far is proof of concept in the purest sense, it’s not really a functioning dynamic questionnaire but technical proof that it can be accomplished. Since I’ve had a lot of customers who have asked for something similar, I plan on iterating on this further with the aspiration of building a generic minimally viable product that people can take and run with.

Would I recommend this approach over the other two approaches we took in the hackathon, the canvas app vs the .NET MAUI app? I think the classic consulting answer of “it depends” applies here. However, based on the complex requirements of this customer I felt that they would eventually be over-engineering a canvas app. With the PCF control in the MDA, I don’t think they’d run into that hurdle. With .NET MAUI, I think the fact that you would be rolling your own offline sync with the app can be considered either a strength or weakness depending on who you ask. While you get that granularity to tweak it exactly to the sync requirements that comes with significant sweat equity of building it. The PCF in an MDA using the new Power Apps Windows App with offline sync gives that for you free if the requirements allow you to relinquish control a bit. The PCF approach is a good compromise between pro-code build the whole thing and low-code what you see is what you get.

--

--