Skip to content

Microsoft Teams, Power Automate and Planner

As we moved to Teams at dbi and one of our customers, automating tasks was a strong need.
One of the tasks that could be automated is the creation of tasks in Microsoft Planner which does not support recurring tasks. Every 4 weeks, we are patching the environment. For everyone awareness and follow up, we need to publish these dates in the planning. As the pace of these tasks is known, it is a bit repetitive to create these tasks manually.

Microsoft Power Automate (previously known as Flow) is powerful tool to automate tasks and it integrate natively with Teams. My idea was to create 4 tasks just by providing the first date and then creating all of them on a 7 days interval.

Flows Overview

  1. Initialize indice to 1. We will use it to iterate
  2. Initialize a First Day of Cycle object based on user input
  3. Initialize an ArrayOfEnv which will be used for naming each task. For example, array can contain:
    1. Sandbox
    2. Dev
    3. Test
    4. Prod
  4. Then create a loop and iterate until we reach 4
    1. Creation of the task with
      • Title based on ArrayOfEnv[indice] content
      • Date based on selected First Day of Cycle + 7 x indice
    2. Increment indice

That’s it! very basic, but can save time.

Formulas

One of the main difficulties was to find documentation on formulas that work.
For example, the date selected will be formatted with a specific format, but AddDays function do not support it well if you don’t provide expected output format. Solution is to force formatting of the date selected and have it the same across whole flow.

Main functions used for this flow:

  • To get value of a variable, I used variables function with variable name as parameter.
  • Add to obviously sum up all parameters provided.
  • Mul to multiply.
  • Creation of an array with createArray and the name I would like for each task:
    createArray('Sandbox','Dev','Test','Prod')

Flows Details

First part of it is the manual trigger with date as input:

Second part is initialization of variables:

Finally, the loop:

Formulas:

  • Title:
    concat(variables('ArrayOfEnv')[variables('Indice')],' ',' Patching')
  • Start and end date Time:
    addDays(variables('SelectedDate'),mul(variables('indice'),7),'yyyy-MM-dd')

Next Steps

For now, it is only a manual trigger of the flow. Next step would be to schedule that at each cycle beginning.

Power Automate looks like a promising tool, but Microsoft must work more on it to be able to have a full text mode as mix of click and formulas makes it impossible to export.

Let’s work together

Ready to operate at
the next level?

Tell us about your challenge. We’ll bring the depth, the expertise, and the Swiss precision.

Microsoft Team

Microsoft Team

Posts published under the Microsoft Team account are collective contributions by the dbi services Microsoft consultants. The practice covers SQL Server across its lifecycle, from installation, migration, and security to high availability with Always On and performance tuning, together with Azure data services and the Microsoft Business Intelligence stack, including Power BI. The team holds Microsoft certifications up to Expert level and operates customer platforms under service level agreements.View Author posts

263 posts since October 2011

Most read in Database

The Database posts our readers open most: the all-time favourites, and what is trending right now.

Leave a Comment

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