Flow when Planner task in specific bucket is completed (Power Automate)

“Is there a way to create a Power Automate flow that would send an email only when a task in a specific Planner bucket is completed, and ignore the rest?


The Planner trigger ‘When a task is completed’ doesn’t give you too many options. You can select the ‘Group Id’, the ‘Plan Id’, and that’s it. There’re no additional options for further filtering among the tasks, all the completed tasks will trigger the flow. Power Automate doesn’t care if the completed task was from one or another Planner bucket. But that doesn’t mean that you can’t build such functionality by yourself.

Get the bucket name

When you check the output of the ‘When a task is completed’ trigger, you’ll notice that the bucket is provided as an id. If you knew the id of the bucket, you could use the ‘bucketId’ value directly. But in this chapter we’ll turn the ‘id’ into bucket ‘name’ that’s easier to work with.

The first step to get the bucket name is to ‘List all buckets’ in the plan. As with the trigger, you can’t filter the buckets directly, you must take all of them and filter them later. Take the output from ‘List all buckets’ and filter the bucket whose ‘id’ is equal to the ‘bucketId’ with the ‘Filter array’ action.

Power Automate completed Planner task bucket

The sole output from the ‘Filter array’ action will be the corresponding bucket, whose ‘name’ you can use.

You can use it in a ‘Condition’ (email only for a specific bucket), or in a ‘Switch’ (different email for various buckets), it’s up to you. You’ve got the bucket name and you can easily use it in the flow.

Power Automate completed Planner task bucket

Note: don’t worry about the ‘Apply to each’, the output from ‘Filter array’ will be always only 1 bucket.

Use trigger condition with bucketId

The second, more advanced option is to use a trigger condition. If you want to process completed tasks only from a single bucket, you don’t have to trigger the flow for each task and search for the bucket name. You can use a trigger condition instead and trigger the flow only for tasks from that bucket. But you’ll need to know the ‘bucketId’ for that.

As already shown in the post on importing tasks in various buckets, you can get it from the ‘List buckets’ action. List all buckets, search for the desired one in that actions output, and take its id. Use it in a trigger condition that will trigger the flow only if the completed action bucketId is the same, e.g.

@equals(triggerOutputs()?['body/bucketId'], 'J7JTnbyxxxxxIPZ6IWO5gAFCK_')

Summary

You’ve got (at least) two options how to recognise the bucket of a completed Planner task with Power Automate. The first option is better if you’d like to somehow process tasks from more/all buckets. With each run it’ll check the bucket of the task and act accordingly. It doesn’t matter that it’ll trigger with each completed task as you process them anyway.

The second option is better if you’re interested only in a specific bucket. You don’t need to trigger the flow for each completed task, but only for some of them. It’s a bit more complicated as you must get the bucketId and create the trigger condition, but it’ll save a few actions in the flow, not to mention a few flow runs.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Add a Comment

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