This Flow I feel like should be unnecessary, but alas it is. The simple idea is to have tasks which are due tomorrow post to your team to help keep people up to date. Planner does offer email notifications which can do the same, they work great, BUT our users disable notifications because they are too verbose at the moment (i.e. getting emails on comments on tasks). We still want to notify the team of the impending tasks, however.
If you’re feeling lazy, go to the bottom of this post and you can download a template for this Flow. I also submitted this flow to the Flow template gallery, we’ll see if it gets accepted.
Let’s head over to Microsoft Flow
This flow is pretty basic, but has some complex pieces, so maybe its baslex. It looks big, but it’s really not.
Overall, everyday at 7AM it gets all tasks from our plan, checks to see if any are due tomorrow, and are not already completed, and then posts a message in the channel in Teams.
Trigger: Schedule – Recurrence
This is simple enough, start the Flow with a Recurrence trigger. I set mine for every 1 Day at 7 AM. This allows us to wake up, come into the office and peruse our Teams, seeing the updates.
How do you test this, you might ask? Don’t you worry about that. You can force this flow to run whenever you want, you don’t have to wait until 7 AM to see if it works! More on this later
Action: Planner – List Tasks
This part was aggravating. If you haven’t noticed yet, there isn’t a clear way to access your Teams and Channels plans through Planner. If you navigate to Planner, you can’t find your plans from Teams. Just the plans at the group level. Microsoft is aware and working on that.
Unfortunately, this carries through to the Flow APIs, and when using this action, you can’t select your channel’s plan. Instead, you can provide the plan ID. To do so:
- Go to Teams and navigate to the Planner Tab.
- Press the Go to Website button in the top right of the window to open Planner in your browser.
- In the address bar of your browser, you’ll want to copy the planid value from the URL. You should see something like this, only copy the red letters portion
- In Flow, in the dropdown selection for the Plan Id, select Enter custom value at the bottom of the drop down
- Paste in the planId from before
- Done! Continue with the flow
After you save it and edit again, it will show the board name, the tab name from Teams, in my case Tasks.
Action: Apply to Each
This is an automatic action, don’t worry about it for now. Flow knows when to add it for you, in the next step.
Condition: If there is a due date
Add a condition, and add the Due Date Time field from the List Tasks action, and BLAM you’ll have the Apply to Each added automatically.
This condition checks if there is a due date. If so, then continue on. If not, stop, do nothing. For the value field, use the expression
Yes, the due date is not null
Condition: If is due tomorrow and not completed
For this condition we are going advanced since we want to check condition on two fields. We want to check is the due date tomorrow and is the task complete. Press the Edit in advanced mode link in the bottom left of the condition to enter a free text field.
Copy in the following, paying attention to weird quotes that sometime come along with copy/paste.
@and(equals(formatDateTime(item()?['dueDateTime'], 'yyyy-MM-dd'), formatDateTime(addDays(utcNow(), 1), 'yyyy-MM-dd')),less(items('Apply_to_each')?['percentComplete'], 100))
Quick explanation of what this is doing
We have an
and() which says each condition in this has to be true. It looks like
and(1,2). Our first
and statement is checking if the due date is equal to tomorrow:
equals(formatDateTime(item()?['dueDateTime'], 'yyyy-MM-dd'), formatDateTime(addDays(utcNow(), 1), 'yyyy-MM-dd')). The second
and statement is check if the percent complete field is less than 100 (since it sets to 100 when someone marks a task complete):
If this is true, then we post the message to Teams. If it’s not true, we do nothing, carry on.
Yes, this task is due tomorrow and its not completed
Now let’s write to Teams!
Action: Teams – Post Message
Select the Team Id and Channel Id you’d like to post your message to.
The Message does support HTML formatting, so you can have some fun here. My expression formats the due date into a short date format:
Take your time, and test out your formatting, and then your team knows you’re being active ;)
Couple of questions, known issues
What about the assigned to field?
Great question. No idea. It’s not available in the Flow action for Planner. So weird. Someone has reported the issue as an Idea, click here to check it out and vote it up! I also posted it on UserVoice, click here to vote this up too!
How do I test this Flow without waiting for the schedule?
After you save/update your flow, you’ll have a Run Now option. It may be in the initial view, or if you’re in the Flow details page, you can select Run Now from the menu
Don’t want to build it yourself?
I’ve exported my Flow for your use, download it here!
I hope this helps you find new ways to use Microsoft Flow! ‘Tl next time, Happy Flowin’!