Microsoft Teams has become a popular collaboration tool for businesses worldwide, allowing teams to communicate and work together seamlessly. But with so many tasks to manage, it can be overwhelming to keep track of everything manually.
Luckily, Microsoft offers an automation tool called Power Automate, which can help simplify and streamline processes. One example of a Power Automate Planner integration is automatically creating a task when a new Teams channel message is detected.
Stay tuned, and we’ll demonstrate a sample use case of Power Automate Planner integration with MS Teams.
Table of Contents
The Power Automate Planner Teams Flow
This example tackles a sample task-creation system in Planner that may be similar to a ticketing system. Instead of creating a new task manually, Power Automate can monitor a channel for new conversations and use its details to create a new Planner task.
The high-level steps are as follows.
- The user starts a new conversation in a Microsoft Teams channel.
- Power Automate monitors the channel for new conversations.
- Power Automate creates a new Planner task with details based on the channel message.
- Power Automate replies to the original channel message that a new task has been created.
The high-level flow is shown in the diagram below.
The Requirements
This flow requires the following components.
User License
The user account you will use to connect Power Automate to Teams and Planner must have a valid license (or licenses) to access:
- Power Automate
- Microsoft Teams
- Microsoft Planner
Microsoft Teams Channel
This Teams channel will be the entry point for new tasks in Planner. This channel can be private or public, depending on your preference or requirements.
In this example, I created a channel called Dummy API Issues inside the DevOps Team.
Microsoft Planner Plan
This Plan is where Power Automate will create the task for each new conversation started in the Teams channel. It’s up to you to design the buckets.
In my example, I created a “Dummy API Issues” plan, and all new tasks created by Power Automate will go to the “New Issue” bucket.
Creating the Power Automate Planner Teams Flow
After preparing the requirements, we can start creating the Power Automate flow. First, log in to your Power Automate app at https://make.powerautomate.com/ and click Create → Automated cloud flow.
Trigger: When a new channel message is added
Enter the new Flow name and choose the trigger. Below are the details for this example.
- Flow name: Automatically create tasks in Planner for Dummy API Issues
- Choose your flow’s trigger: When a new channel message is added
- Note that the “When a new channel message is added” triggers only when a new root message is created in the channel. Replies to an existing channel message are ignored.
Select the Team and Channel to monitor and click New step.
Condition: Check if the channel message is not empty
Next, let’s add a Condition to serve as our guard clause. This condition tests if the new channel message has a subject. If there’s no subject, then the flow will not continue.
The expression used is:
empty(triggerOutputs()?['body/subject'])
This condition ensures that only the new messages with a subject line will be processed because the new task’s title will be the message’s subject line.
The Condition creates two result branches: “If yes” and “If no”. We’ll continue creating steps inside the “If yes” branch in this example.
Action: Get Message Details
Now that we determined that the channel message has a subject, let’s retrieve the message details so that we can use them for reference later.
Click “Add an action” and select the “Get message details” action.
Select the “Message id” dynamic content in the “Message” field.
Select Channel as the Message type.
Select the Team name from the Team field.
Select the Channel name from the Channel field.
Action: Compose the Reference ID
Adding a reference ID to a task helps uniquely identify the task created. You can think of a Reference ID as a reference or ticket number.
In this example, the reference ID will be derived from the time stamp of the channel message creation “SR-” prefix.
SR-yyMMdd-hhmmssff
Click “Add an action” and select the Compose action.
In the “Compose” step, add this expression inside the Inputs field. This expression uses the [concat() function](https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-concatenate) to concatenate “SR-” and the date time format ‘yymmdd-hhmmssff’.
concat('SR-',formatDateTime(triggerOutputs()?['body/createdDateTime'],'yymmdd-hhmmssff'))
Rename this step as “Compose Reference ID”.
Action: Create a Planner Task
This step creates a new task in Planner.
Click “Add an action” and select the “Create a task” action.
Specify the details for the new Planner task to be created:
Group Id: Select the group to which the planner is associated.
Plan Id: Select the Plan name from the dropdown.
Bucket Id: Select the bucket to which the new task will be created.
Title: Enter this expression for the task title:
concat(outputs('Compose_Reference_ID'),' | ', triggerOutputs()?['body/subject'])
The above expression combines the reference ID created in the “Compose Reference ID” step, the pipe (“|”) character, and the Teams channel message subject line.
Action: Update the Planner Task
The task was created in the previous step (Create a Planner Task), but the only information it had was the task title. We’ll update the task description with the channel message body text in this step.
Click “Add an action” and select the “Update task details” action.
In the Task Id field, select the Id dynamic content. This is the Task Id created in the previous “Create a task” step.
In the Description field, select the “Body PlainTextContent” dynamic content.
Action: Reply with a Message
Once Power Automate automatically creates the Planner task, the submitter should get a response for confirmation. We’ll add a step to reply to the original message for the following action.
Click “Add an action” and select the “Reply with a message in a channel” action.
Select “Flow bot” in the “Post as” field and Channel in the “Post in” field.
Select the “Reply To Id” dynamic content in the “Message Id” field. This field represents the message ID to reply to.
Select the Team and Channel. Type the reply message in the Message box. You can customize the message and apply HTML formatting tags if you prefer.
Finally, click Save to save your new Power Automate Planner Teams flow. Your flow should look similar to the one below.
Testing the Power Automate Planner Teams Flow
Once you’ve created the flow, it is good practice to test it. To do so, click the Test button.
Select Manually and click the Test button.
Switch to Microsoft Teams and click New Conversation inside the channel.
Click the Format button.
Type the subject and body of the message and click Send.
Switch back to your Flow and confirm the result. The example below shows that the flow ran successfully.
To further confirm, check the channel message, and you will see the reply from Power Automate.
Click the Reference ID to open the new task in Planner.
That’s it! From this point forward, new conversations in the Teams channel will have a corresponding task created in Planner.
Conclusion
Throughout this blog post, we explored the step-by-step process of setting up an automated task creation system using Power Automate and Microsoft Teams. We learned how to create a flow that triggers when a new message is posted in a specific Teams channel and automatically creates a corresponding task in Planner.
By harnessing the power of Power Automate Planner Teams flow, you can automate task creation in Planner and optimize your team’s workflow. Embracing automation can unlock new levels of efficiency, accuracy, and collaboration, empowering your team to achieve its goals more effectively.
So, take the first step towards automated task management and experience the transformative power of technology in your everyday work life.