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.
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.
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.
- Open the Model-Driven App designer and add a group called “My work”.
- Add a “Table based view and form” Page.
- Select Task and press add.
- Check if the Tasks are added to the “My work” group. If not add the Tasks to it.
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.
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.
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”.
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”.
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.
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!
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.