Set up Tasks for your Model-Driven Power App

Shows an animated gif of where in the View you can Mark a Task as complete. Then it opens the Task in a Form. Shows where the Mark Complete button is and then presses it. The task no longer is on the View

In this blogpost I will start with the basics of “Task based work”. A task system that consists of a framework to add and coordinate tasks from a Model-Driven Power App. It is not very complex to begin with, but I will add more complex functionality to it as we go. This functionality heavily depends on the integration scenario we want to implement. In this post I have summed up a few possibilities.

Scenario

A quick reminder of what we are working on. The big theme of my blog currently is the “Case of the broken screen”. A lot of my blogpost are about this business problem. A loyal customer has dropped their new and expensive phone and his screen is cracked. It is up to us to resolve this incident to satisfactory of the customer. It’s time to send out a replacement screen!

The caveat though, is a different department handles shipping. Sending a handwritten note or an e-mail to that department might get the job done, but it will not create tangible data to work with. So now we want to set out tasks to the logistic department who are not using our application. We also want to be able to track those tasks, make sure they get done and keep our customer informed of the status. Eventually you would want automation in place to be notified at the right time.

Task System

Before we even begin thinking about integrating and automating steps in this process, we have to make sure we can register it manually. This is where implementing a Task System comes in. Dataverse contains a Task table out of the box. The Task table is of the Activity type. An “Activity Type” table contains records that you can specify on a calendar. Or set to a specific point in time. It contains for example a start- and end-date, duration and can be completed or cancelled. The Task table inherits this behavior and adds its own.

Let’s start by adding the Task table to the Model-Driven App. I want to create a place where users can see their open Tasks, open them and work through them.

  1. Open the Model-Driven App designer and add a group called “My work”.
  2. Add a “Table based view and form” Page.
  3. Select Task and press add.
  4. Check if the Tasks are added to the “My work” group. If not add the Tasks to it.
Shows the Model-Driven App Designer. The Task table has been added and is now highlighted in the preview window. It also shows the View My Tasks.
App Designer after Task has been added

Less is more

I always limit the forms and views available to the users by default. With the out of the box tables, you get a lot of different options. If the user accidently opens the form or view switcher it might get overwhelming, or at the very least distracting.

To do so expand the Tasks on the Pages tab of the App designer. Select the Task view underneath. On the property tab on the right of the screen you can add views that are available in the App. Press add a view and select the My Tasks view. The My Tasks view comes with a filter to only show “Open” tasks for the currently logged in user.

Shows the Model-Driven App designer. The Task table is expanded, and the Task view is selected. Highlighted on the right side of the screen is the Add view button. Within that highlight is the My Task View the only view selected.
Set-up My Tasks

Do the same for the form. Select the Task form on the Pages tab. And add the Task form of the type “Main Form” to add it to your app.

Shows the Model-Driven App designer. The Task table is expanded, and the Task Form is selected. Highlighted on the right side of the screen is the Add form button. Within that highlight is the Task Form the only form selected.
Set-up Task form

After you press save and publish your users now have a way to see their open tasks and work them. You can then proceed to edit the view and form to your liking. Add and remove relevant columns or fields that suit your need best. On the form I like to add the Due Date, this field is already on the header, so be sure to Uncheck the “Show only unused table columns”.

Shows an animated gif of where in the View you can Mark a Task as complete. Then it opens the Task in a Form. Shows where the Mark Complete button is and then presses it. The task no longer is on the View
Mark Task as Complete

On a specific Task or if you select a Task in the View, you can see a button “Mark Complete”. With this you can update the status of the Task from “Open”, to “Completed”. This will also remove it from the My Tasks view.

Create Tasks to be done from a specific Case

Now that we have a way to work with Tasks inside our application, let’s make sure we can relate Tasks to Cases we are working on.

The Task table contains a column called Regarding. The Regarding column is a polymorphic look-up. Meaning it can contain different kind of tables as a reference. We want to link Task to our custom table Case. For custom tables to appear in this look-up, go to the properties of the table, choose advanced and under the header “Make this table an option when” select the checkmark at “Creating a new activity”.

Shows advanced properties of a Dataverse table. Highlighted is a checked checkbox for "Creating a new activity".
Appear in Regarding of a Task

This makes a relationship between this table and the Task table, after you save and publish. In my example this is the Case table. We can then proceed and add related Tasks to the Case records. To do so open the main Case form in the Form Designer. For simplicity let’s add a 1-column tab to the form entirely for the Tasks related to the record. On that tab we add a Subgrid from the Components on the left side.

Shows the Power App Form Editor to add a Subgrid to a new 1 column tab. The Subgrid added is of the table Tasks and the Default view is All Tasks.
Add Task Subgrid to Case form

Press the checkbox for “Show related records”. With this checkbox we can now only select the tables with a relationship to the Case table. Because we also want to see Tasks that are completed, we select “All Tasks”. Press save, publish and test it in your app!

Shows a subgrid of Tasks added to the case record. Here we can see all related Tasks to the Case. We can also create new Tasks.
Task Subgrid on Case table

The End Result or just the Beginning?

Now we can add Tasks from within a Case. We can assign them to a person, or a team and it will show up on that persons Tasks view. This of course, is only the beginning of my journey into exploring what automation and integration you can do with Tasks coordinated from a Model-Driven Application in the Microsoft stack.

Leave a Reply

Your email address will not be published. Required fields are marked *