I have written before about how I using Microsoft Flow to automatically create GitHub Issues from tasks in Planner. This is working fine for the project I am working on, but we needed more for our web development team.
Our development team is growing and they are using Planner as there KanBan board. We wanted to create a Github issue when a task is moved from the backlog to the sprint backlog. So the trigger in Microsoft Flow is when a Planner task is moved. But that trigger doesn’t exist :(.
The connector and there triggers and actions in Microsoft Flow are create by Microsoft self. We can’t create our own triggers or actions. So sometimes we really mis a feature we need, just like this one. The only triggers available in Flow for Planner are:
- When a new task is created
- When a task is completed
- When a task is assigned to me
And what we really need is the trigger, when a task is moved. And it seems we are not the only one. You can post ideas or suggestion on the Microsoft PowerUser forum and this one is also listed there for more than a year.
Triggering a Flow when a task is moved
So we need a workaround for this. We need to find a way to check if a task is moved to another bucket and create a GitHub issue when it’s. After some testing, I came up with a solution that works quite well.
Instead of focusing on the task moved action I decided to run a Flow every 10 minutes. In the Flow, we will get all the task for a plan. For each task, we check if it’s in the correct bucket and if the progress is on 0%. If so we create an issue in GitHub and set the progress to 50%.
Creating the Microsoft Flow
Time needed: 15 minutes
- Create the recurrence trigger
We start with the recurrence trigger. Set it to an interval of 10 minutes or whatever works for you.
- List all task from the plan
Create a new step and select the List tasks action from Planner
- For each loop
Next, we want to loop through all the task in the list. Add a new step and select the built-in action apply to each.
Select the output Value from the previous step.
- Check the bucket
Add an action in the apply to each. Select the condition action from the built-in actions. We are going to check the value Bucket Id and it has to be equal to the bucket Id that we found in Planner or Graph.
- Get the task
If the task is in the correct bucket we are going to get the task. Not the task details, because that will only return the description. Add an action in the If Yes part and select the Planner action get a task.
Link the task Id by using the Value Id field
- Checking the percentage
Now we need another condition, we are going to check the task progress. Add a condition below the Get a task action. Check the Percentage Complete value, it has to be equal to 0.
- Create the GitHub issue
If the percentage is 0 we have a new task for this bucket. So we are going to create a GitHub issue from it. In the If Yes part we add the action create Issue.
I leave the details out of this article, check this article if you want to know more about it. If you need the task description (and you probably do), you can add the Planner action, get task details
- Final important step
The last action in If Yes is to set the percentage to 50. This way we know that this task is processed when the flow runs again.
Add the Planner action Update a task. Set the task id (just scroll down to Enter Custom value) and the progress value to In Progress
Microsoft Flow is a great tool to automate things. Also, the platform is still growing and new connections, triggers and actions are added regularly we still miss some basic actions or triggers in it.
Sometimes by thinking a bit out of the box, we can still automate our tasks, we just need to take a look at it from another angle.