cancel
Showing results for 
Search instead for 
Did you mean: 
frederikbisback

Copy Planner task from one plan to another, towards the same bucket name

Intro

Getting into planner for managing the work of your teams, but you are lost in the total overview! Centralize the planning of your teams by creating them in an automated way toward a plan that will contain all teams.

Need more information about Microsoft Planner: LINK

Take the chaos out of teamwork and get more done! Planner makes it easy for your team to create new plans, organize and assign tasks, share files, chat about what you’re working on, and get updates on progress.

How-to?

In Planner you have for example a plan of a team and a second plan that will be the centralized plan of other teams.
Source: TEST FBI - PLANNER01
Central: TEST FBI - PLANNER02

Planner01.pngPlanner02.png

Three buckets created, that can visualize the planning of your customers. The buckets need to be have the same name in each plan. So that a task created in bucket "BUCK01", will be copied to the bucket "BUCK01" in the centralized plan.

So when do we start? New task has been created in the plan PLANNER 01. This will be a trigger for the Microsoft Flow. Let's go to Flow ... already we will have some exceptions in the Flow that will be explained in this blog.

Create a blank new Flow and add following trigger [When a new task is created], and select the source plan. Here PLANNER01.

Planner03.png

First some background to understand the following steps:

Buckets

You can sort the tasks into buckets to help break things up into phases, types of work, departments, or whatever makes the most sense for your plan.
The bucket has an unique bucket ID, see body output of the trigger:

 

Planner_Code01.png

The bucket id is for each plan unique. So the only way to match both buckets of each plan is the unique name “BUCK01”. So we need to have a mechanism to match the correct bucket name.

 

We can use the Flow action “List Bucket
Planner_Code02.png

In the bucket list, we can find both values. How do we match the first bucket value id towards the name of both plans and get the bucket id of the centralized plan. Therefore we create two variables (Type: string), one for the source bucket name and a variable for the destination (centralized plan) bucket ID.
Planner04.png

Rename the action to the appropriate description/name. Search for variable and select initialize variable.

Planner05.pngAdd two actions “List buckets”
Planner06.png
Search for action “List buckets”

Planner07.pngGetting the name of the unique bucket id from the trigger, can be done as follow. Compare the value of the bucket list of PLANNER01 with the body bucket id that can be found in the trigger output. Create a new action “Apply to each” and select an output of previous steps, equal to the value:

Planner08.png

Compare the bucket id’s, by adding a “Condition” – control “is equal to”

Planner09.pngPlanner10.pngPlanner11.pngIf it’s equal we will set the variable “ScrBucketNme” to the bucket name of the source plan bucket list.Planner12.pngPlanner13.png 
The opposite we will done, getting the bucket id of the centralized plan. Create a new action “Apply to each” and select an output of previous steps, equal to the value:
Planner14.png
Condition has been added to get the unique bucket id of the plan PLANNER02.
Planner15.pngPlanner16.pngPlanner17.png  

It’s equal.

Planner18.png

At this moment we have all the information to create a task in the centralized bucket “BUCK01”. But we need to solve still one problem. A task can be assigned to a person. But also the person has an unique ID. But this cannot be found in the standard dynamic content of the trigger “When a new task is created.”

Again the output of the trigger:

Planner_Code03.png

You can find the persons unique ID in the “assignments” of the JSON – output. Create an action to “Initialize variable”, here we a the following substring – expression.

Planner_Code04.png
We need to get the information of the string assignments” and id (2) and ac45b0b4-1a2b-46a6-b2d3-7c4a6f4dd458 (36)

substring(string(triggerBody()?['assignments']), 2, 36)

 

Planner20.png Do we have everything, Yes! We can create the task in the centralized plan in the correct bucket, equal to the source bucket name.

Planner21.png Complete overview of the flow:

Planner22.png 

This will result in the following output in Planner.

 Add Task in PLANNER01Add Task in PLANNER01Add Task in PLANNER01Task has been createdTask has been createdTask has been createdPLANNER02 is emptyPLANNER02 is emptyPLANNER02 is emptyFlow has been executedFlow has been executedFlow has been executedTask has been created in same bucket nameTask has been created in same bucket nameTask has been created in same bucket name
Enjoy! Feedback is welcome.
Would you like more of these Flow examples? Suggestions are welcome ...
Comments

Hi,

It was great thank you . just I have a question. how we can get more than one assignment?

Sanaz,

I have the same problem! =/

How to do with more than one assignment ?

I tried with two , but flow creates two new tasks...one for each assignment.

 

 

 

@CrazyleX 

Hi,

I did like this:

 

 
 
 

Annotation 2020-05-07 000554.png

@sanaz 

 

Hi!

Thank you very much!

Helped a lot!

😃

 

Frederik

Thank you very much!

 

Anonymous

This worked great for me! I'd like to use it to copy existing tasks as well - not triggered from "When a new task is created". However, when I switch it to be a manual trigger, I lose the bucketID in Dynamic content. Is there a way around that?

Great article. 

 

Only problem is that we don't seem to be able to add the Notes or Checklists with a task. Any way to do that?

 

Mark

Hello @Mark, Indeed is not possible with the action: https://learn.microsoft.com/en-us/connectors/planner/#create-a-task

 

You can update the task description at https://learn.microsoft.com/en-us/connectors/planner/#update-task-details

frederikbisback_0-1666951752356.png

 

I hope this helps. 

 

 

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/