In today’s data-driven world, it’s becoming increasingly important to separate data from logic when building applications. This separation not only helps keep your code organized and maintainable but also makes it easier to manage and work with your data. In this blog post, we’ll explore how to use Template Tasks to separate data from logic and make your applications more efficient and easier to manage.
I will do this by expanding my previous blogpost where we generate Tasks using a Custom Page. In that blogpost I show how to generate Tasks to help the user in their work. However for simplicity it did not contain a Description, or even all fields. Thus the Power FX logic looks pretty clean. If we want to keep it clean we can separate the data by using Template Tasks. By storing the data in Dataverse and using template tasks to generate tasks based on logic inside the Custom Page, you can create a more scalable and flexible workflow.

Anyone can edit Template Tasks
The main benefit of separating the data from the logic is that everyone can edit the Template Tasks. Which means if someone decide they need to add detailed description to a Task, they can do so without editing the Power FX in the Custom Page. You can surface the Template Tasks inside a special administrator Model-App, or use a security role to show specific views and forms.
It will also make your app logic more clear. In my previous blogpost we already had a switch and several if statements. If we also add large descriptions, like the example below, it will be very hard to read the actual logic. Creating readable and simple to understand logic is still an important skill to have, even if you are using low-code!

Set-up Task Templates
Now that we know why it’s a good idea to use Task Templates, let’s talk how you can set this up. First I add 2 new columns to the standard Task table.
- Is Template Task. A Yes/No column to indicate if this Task is a Template
- Type. A Choice field which we will fill with all different template Tasks we want to generate.


I also create a specific admin Form to create and edit a Template Task. For each Task we generate in the Custom Page I create a Template Task with the corresponding Task Type. I set the Yes/No field to yes when it’s a Template Task.

Revisit the Power FX logic in the Custom Page
We now have the basis set up to expand our Custom Page. I want a collection of all Template Tasks so I can use them later to generate Tasks. On the OnVisible of the Custom Page add the following Power FX:
ClearCollect(colTemplateTasks, Filter(Tasks, 'Is Template Task' = 'Is Template Task (Tasks)'.Yes));
Now on the OnSelect of the Generate button we can add LookUps to the Subject and Description of our Task Templates.

And for the end result when we generate a Task we get the same task. But with the added (and important) benefits of relatively clean logic and the ability for a business user to change the data of the Task description.
