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.