Managing Tasks using Flow

Laura Graham-Brown

0 comments

Creating Tasks

Tasks can be created in various different task management environments. In this chapter, we will look at creating a task in Planner, Wunderlist, Todoist and Trello. For these examples, I have used a simple button trigger, but the trigger could be any action, new document, new calendar entry or scheduled for a particular date.

Calculating Due Date

All tasks can include a due date so the first action before creating any task we will calculate a Due Date based on today’s date plus 14 days.

  1. Add an action of Initialise Variable and rename it to Initialise Variable DueDate.
  2. Enter in the name DueDate and set the type to String.

Dates are stored as strings in Flow in a standard string format.

  1. For the value click in the box and then click on Expression in the Dynamic Content box. I want to add 14 days to today’s date so we use addDays and utcNow functions.

Creating a Todoist Task

Todoist is a straightforward task management environment, with an Inbox and other Projects. When you add the action to create a Todoist task you can select the Inbox or Project from a Project Id dropdown.

Click on Show advanced options to reveal extra fields including the Due Date.

Creating a Wunderlist Task

Wunderlist is very similar to Todoist organising the tasks in lists including an inbox, which can be selected from the List-Id dropdown. The Due Date again is hidden in the advanced options.

Creating a Trello Card

Trello is slightly different in that it calls tasks Cards and they are organised on boards. The cards include a description and again the Due Date is hidden in the advanced options.

Creating a Planner Task

Planner has two levels of organising tasks, the top level plans and within each plan, you can have buckets of tasks. The tasks also have a start and due date and because Planner is part of the O365 platform we can assign a user to the task.

In this instance, we will use the email of the person who initiated the flow.

Copy new task into Planner

Often the problem with task management is bringing all your tasks into a single place. One important part of this is when a new task is created in one of the other lists it is copied to the central task list. This example assumes you already have a plan and bucket setup in Planner.

For this example, we will write a flow that is triggered by a new task in Wunderlist and copies it to Planner.

  1. Create a blank flow and add a trigger from the Wunderlist connection of When a new task is created.
  2. Select which list is going to be checked. Note this does mean you need a separate Flow for each list in your Wunderlist environment.
  3. Next, add a task from the Planner connection of Create a task.
  4. Select the Plan Id and Bucket Id from the ones you pre-prepared.
  5. Use Dynamic content from the trigger action to populate Title, Start and Due Dates.
  6. Save your flow. Add a task in Wunderlist and check Planner to see if the task appears.
  7. Do remember that according to your plan you might have to wait a few minutes

Importing Tasks from Todoist

The previous section copies new tasks from one environment into Planner. That is okay if the list is new and contains no tasks. If there are already tasks in the list they will need to be imported so the lists start in sync.

In this example, we will copy tasks from Todoist into Planner. Each project in Todoist will be a bucket in one of the plans in Planner.

The trigger for this flow will be a button as we only expect this to be a one-off import.

The first action will be to list all the projects within Todoist. This action does not require any parameters.

Now for every project returned we want to create a bucket named after the returned project. In order to loop through all the projects, we need an action from Control called Apply to each.

Select Projects from dynamic content for the parameter.

Then add an action from the Planner connection of Create a bucket. From the dynamic content pane under List Projects select Projects Project Name for the name of the bucket.

Running the flow now will just create empty buckets matching the project names.

We now need to fetch the list of tasks from each project. Add the action from Todoist connector called List tasks by project. For the Project Id we need to select Enter custom value from the drop-down. Then the dynamic content panel will appear and you can select Projects project id.

After the List tasks, you need to add another Apply to each to work through the list of tasks returned. Inside the new Apply to each, we can add the Create task action from the Planner connection. We need to select Enter custom value for the Bucket Id so we can select the Id from the Create Bucket Action.

Run the flow to test the import. The final flow is as follows.

Importing from a SharePoint Task list

Many departments have used SharePoint task lists as a quick and easy way to manage a small project but a SharePoint list does not work well on a mobile device where ToDo offers an app. So a useful transfer would be to import tasks from a SharePoint list into another environment.

Again, this flow is a once-off import so will be triggered from a button. The first action is to get the items from the SharePoint list.

We then need to be very similar to our previous flow loop through all the items returned and add the tasks to ToDo.

The Subject of the ToDo task can be the Task Name from SharePoint.

When it comes to populating the Due Date and Start Date though you will not be able to find these listed in the Dynamic content. Add a to-do action is still in preview, which means it will have some bugs and this is one of them. (Unless you’re reading this in the future then hopefully they fixed it)

So we need to add it using an expression. The function Item() returns the current item in the Apply to each and adding ?[‘propery name’] returns the value in that property. So we add DueDate and StartDate values.

If your tasks include descriptions you could add it into the Body Content. Run your flow to test.

Import from Project Online into Planner

Project Online is perhaps one of the less well-known task management tools outside of the project management world. Inside the project management world, Microsoft Project is well known and various companies have adopted Project Online as part of their project management methodology.

Microsoft Flow does not have a huge number of actions for Project Online and some of them are lacking some of the obvious requirements. In this example, we will look at a simple import from a single Project into a Planner. We shall use a button trigger.

The first thing we need to do is list the tasks from a project. So I add a List Tasks action from the Project Online connector.

Unlike most other actions which have requested an id, there is no dropdown to help us select a project. So we will need to get the Project ID manually.

So I delete that action and start by listing the projects from the project site.

When I run the above simple flow and examine the results I can see that List project returns lots of fields for every project including Name and Id.

So we can filter the projects based on the Project Name as I know that and then extract the Id. So the next action is to Filter the array which allows us to add the condition

Returned Project Project Name is equal to Flow Summit

Although we know the filter array will return only one row, Flow doesn’t know that so we need to now extract the Id from the first row. This can be done using a Compose action with an expression.

We can then test run the flow again and look at the result of the Compose action

Finally, we can now list the tasks from that project using the output from the Compose action.

The next stage is to create a bucket and then add each task to the bucket. Just as before to loop through all the tasks we need to use an Apply to each control action. So we add the following

Please note the extra capital Z added to Start Date Time and Due Date Time. This is due to the difference in the date-time string provided by Project and required by Planner.

When you run this Flow you might get more tasks than you expected. This flow copies across all the tasks including summary tasks. So our final change to the flow to prevent this is to tweak List Tasks. Click on Show advanced option and in Filter Query we need to enter an OData filter to filter for tasks where the IsSummary property is false.

A final run-through of the Flow should copy the tasks across. The tasks will be in reverse order sadly as you cannot at the moment sort arrays.

0000-00-00 00:00:00


Leave a Reply

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

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}