ReadyXRM

Replacing a Dynamics 365 Dialog with an Embedded Canvas PowerApp

In case you haven’t heard, Dynamics 365 Dialogs have been on the deprecated list for a couple of years now.

Dialog Deprecation Announcement

Now, remember that “Deprecated” doesn’t mean “Removed”. It means that the particular feature will no longer get any updates or enhancements, but it will generally still be usable.

You can still build Dialogs today, and if you continue to use the Classic Web Interface, these Dialogs will continue to work.

However, as you move over the to new Unified Interface, you will find that you are unable to use your Dialogs.

Microsoft Docs even has a page stating that instead of Dialogs, to instead use Canvas based PowerApps (or Business Process Flows).

I ran into this issue recently, but the good news is that I was able to build an embedded Canvas PowerApp that not only replaced my Dialog functionality, but I feel made it better.

Business Case: Project Task Tracking

For the particular client that I am working delivers specific programs and projects. The funding agreements for these projects are based on a series of objectives, and the organization must report on the tasks and outcomes they did against the particular objectives. The monthly or quarterly report to the funding agencies also must follow a particular format.

This was an incredibly time-consuming process to fill in the report template and also go through email and notes to track all the activities. Staff would also track the work in ad-hoc Excel spreadsheets and cut and paste into the report at month end.

The client was already using Dynamics CRM for stakeholder management so I built an xRM application to track projects and related objectives.

At the end of the month, the users would run an SSRS report that was built in the required format that broke down the objectives and related tasks. The report could be then be e-mailed to the appropriate project funders.

The users could use the Dynamics CRM for Outlook client to track emails and tasks to the specific project objectives.

There were still other activity logging that needed to be done. These were tracked as tasks against the project objectives directly in Dynamics CRM.

This became a bit tedious because this involved some navigation and a series of clicks to drill down from the project form, then to the objective form, and then the user would then add the task record.

In a lot of cases, there is work being done that could potentially span multiple projects and objectives, so involved some awkward cutting and pasting.

To speed up the process, I built a Dialog in Dynamics 365 to make it easier for staff to capture and track project activity from within the project also have the ability to copy the task to multiple projects.

Part 1: The Dialog

Part 1 talks about “the old way” and provides context, if you want to see the new stuff, skip ahead to Part 2.

The structure in Dynamics 365 is pretty simple, there is a project entity with related objective child entities.

Project Entity

To create tasks, the user would need to drill down to the objective and then locate the Activities view to add tasks.

Adding Task “the long way” via Objective

To make the process easier, I created a Dialog and had it launched from a button that I added with the Ribbon Workbench. The Dialog runs from the context of the project, it shows the list of objectives in a picklist and allows the user to enter in the task details.

After the task is entered, the user is provided with the option to copy the task to another project.

The user can now choose the project from a lookup.

Once the project is selected, they can again pick the objective and either keep or change the task information entered.

The Dialog is recursive so the user can copy the task to as many project/objectives as required.

The Dialogs are actually 2 distinct Dialogs, the first is run from the context of the project. The Dialog will query for objectives based on that project. The user can choose the objective, enter details and then choose to copy the task, which will launch the “Copy Task Dialog”.

The child Dialog can continue to get called as many times as required.

The Unified Interface

I have begun to migrate this xRM App to a Model Driven PowerApp. The new Unified Interface is faster, easier to navigate and can run on different form factors. It is the future of Dynamics 365/CDS Applications.

However, it does not support the running of Dialogs! When I test the new app and attempt to run the “Task Entry Dialog”; I get an error.

I did some research and there isn’t a way to run a classic Dialog in the new Unified Interface. It is also highly unlikely that Microsoft will add this ability as the Dialogs are technically deprecated.

To re-add this functionality, my options were limited. Task Flows wouldn’t cut it as I couldn’t query data. Using Microsoft Flow also wouldn’t work on its own because you can only enter values at the start, and they also do not support lookup values.

This left me the option of creating something custom or looking to an ISV such as TKDialogs. While TKDialogs is an excellent product, in this case, it was a bit overkill for what I needed.

Part 2: The Embedded App

Microsoft recently announced the ability to embed a canvas based PowerApp on a Modal Form. This is currently in public preview. This appeared to be a great low-code, no-code solution, but could it replicate the functionality of my Dialog? The answer is it could!

The following is the end result and we will get to the actual building of the embedded PowerApp in a bit.

I added a new tab on the project form called “Project Tasks”, this is where I embedded my app. Currently, you can only add one embedded App per Model Driven Form.

The current entity context is passed to the Canvas App. From this, I was able to add a dropdown showing a list of the particular project’s objectives. (More on this later). Then I had fields where the user can enter in details about the task.

Embedded PowerApp

When the user clicks the “Add Task” button, it actually fires a Microsoft Flow that creates a new task record linked to the Objective. It then shows a success screen and can prompt the user if they want to copy the task to another project or create a new task. This now works better than the original Dialog process.

Success and options to copy or add another Task.

If the user decided to copy the task, they would navigate to a screen where they would choose a project, which would then provide them options for the related objective. The task information would still be present in the form so the user could edit it before copying the task.

Adding the Task to a different Project

The user could continue to copy the task to as many projects/objectives as they require. This essentially has fully replicated the original Dialog.

Part 3 – Building the Embedded Canvas App

The process of building the embedded canvas app had a few challenges but going forward, really would not take any longer than building a classic Dialog. The following is a basic overview, as each Dialog will have its own process and functions, but I hope you get the basic idea.

When I started the project, I actually built a complete standalone App for adding project tasks. This App has its benefits as well (mobile-enabled, easy to use) but I also wanted the users to be able to work within the context of the project record in the Model Driven App.

The first thing I discovered is that I was not able to use my previously built standalone Canvas App for my embedded App. Embedded Apps can only be created from within the Model Driven Form editor.

The first thing I had to do was add a simple text field to my form. I added it to a new Tab called “Project Tasks”. Note that you need to use the classic form editor experience to create embedded apps.

Text field added to Model Driven Form

To create the Canvas App, you will need to look at the properties and add a Canvas app control. Note that this can only be used on the Web client.

Adding the Canvas app control and creating the PowerApp

From the field properties you will create a new Canvas App. This looks the same as any other Canvas App you would create from the Maker experience except you will have a ModelDrivenIntegration component. By default, it will link to a Gallery. This is how the context of the entity is passed to the Canvas App. Note that this component can only READ the data from the Form and we cannot update any Model Form Fields, etc. but we can write data directly to CDS using various methods.

Embedded Canvas App with Model Driven Integration

My Dialog queried the Dynamics 365 data for a list of objectives linked to the project. For our Canvas App, we will link to the Common Data Source data, from the same environment as our Model App.

Objective CDS source (note will look at Project in a bit)

Since we only want to see objectives in context to the project, we will point a drop-down control to the CDS source with a filter based on the project entity passed to the app.

NOTE: For some reason, the Filter formula will change when the component is renamed, or other minor adjustments, and will no longer work. I highly suggest making a copy of this formula exactly and save it. When the dropdown stops working, you can paste the original working formula back.

Filtered List of Objectives

We add date and text fields for information the user will key in. For the “Add Task” button, we actually will save the values to variables (in case we want to copy) and then launch a Microsoft Flow to create the task, and then navigate to the Success screen.

Add Task Button

You will need to create the Flow before you can access it in the PowerApp. Choose the PowerApps trigger for it to show up in your PowerApp. The only reason why I choose Flow as opposed to writing directly to CDS from the PowerApp is that at this point you cannot set the “regarding” when you write to a task in the Canvas based PowerApp, but you can using Flow.

Microsoft Flow to Create Task

I created a screen for after the “Add Task” button has been clicked with options to copy or create a new task.

Success screen

I created another screen to copy the task to a different project. I have a Common Data Service connection to projects. I filter the objectives dropdown to whichever project is chosen. Again, this filter changed by itself a few times so be sure to copy the formula as a backup. The “Add Task” button trigged the same Microsoft Flow as the main screen.

Copy Task to different Project Screen

There is some additional functions (cancel, clear screen) and some labels and other aesthetics.

Summary

The embedded app in this case not only was a replacement for my Dialog, but also looks better, is more intuitive and has a lot more flexibility. This feature is currently in preview and is evolving, so deploy to production with care.

The fact that Dialogs are being deprecated should no longer be a concern for Dynamics 365/PowerApp makers.

Cover Photo by Cindy Chen on Unsplash

Project Photo by Jo Szczepanska on Unsplash

Nick Doelman is a Microsoft Business Applications MVP and will be speaking at User Group Summit (CRMUG/PowerAppsUG/FlowUG) in Amsterdam from March 27-29. Nick is will also be teaching his Portals Jump Start class at the UG Academy on March 25-26th.