cancel
Showing results for 
Search instead for 
Did you mean: 

Email a Summary of Project Online Tasks

Introduction

Flow includes a list of actions for Project Online which include getting a list of projects and getting a list of tasks. This post will work fetching the late and upcoming tasks for one project and then creating the email to send. The trigger for this example will be a scheduled trigger once a week on a Monday morning. This post is split into 3 parts, getting Project ID, Listing the tasks and Sending the email. Using the same structure Flow will be split into three scopes.
The final email will look like this.

lateproject_00.png

Getting Project ID

The Project Online connection includes an action of List Tasks. This action requires 2 parameters, URL of the project site and the Project ID. Unlike some other actions in flow when you enter the URL you do not get a drop down of the available projects, we need to get project id first.lateproject_01.png

We know the project name so we can fetch the list of projects and then use the name to filter the returned array. List projects action does not include an advanced features so we need to use a Filter Array action.

So before the List Tasks action can be added, I add a scope to the flow and add a List Projects action and then add a Filter Array action to filter it down to the Returned projects Project Name equalling "Training Plan".lateproject_02.pngThen we use a compose action to get the Id field from the first row in the filtered array. So I add a compose action and click on expression and add the following

first(body('Filter_array'))?['Id']


lateproject_03.png
Then I run the flow to check that the compose action does return a project id. The compose action should return an Id. Then I am ready to use that Id to get a list of tasks.

lateproject_05.png

Fetching Tasks from Project Online

For this post I want to list Late tasks and tasks due in the next 7 days. So this will not include Summary tasks and tasks that have been completed. This means that in the List Tasks action we can use an OData filter to not include them.

I start by adding a new Scope action and rename it to Get Task Lists. I add List Tasks from the Project Online connector and use the output from the Compose action
Then I expand the Advanced options to add an OData filter which is:

IsSummary eq false and PercentComplete lt 100

lateproject_06.png

In the email I want to lists of tasks, late ones and upcoming ones, so we do two filter arrays. The first filter is a simple one of the finish date being less than today so can done using the simple editor.lateproject_07.png

The scond filter array needs the Finish date to be greater than or equal to today and less than today plus 7 days. This will require the filter to edited in advanced mode. So add the Filter Array action and click Edit in advanced mode. The formula is

@and(greaterOrEquals(item()?['Finish'], utcNow()),less(item()?['Finish'], addDays(utcNow(), 7)))

lateproject_08.png

Compiling Email

In order to create the email I will convert the two filtered arrays into html tables and then add headings before each table. I add the final scope to create the email. The two tables are created using the same action, from is the body from the filter array actions and I've included headings and columns are Custom. Also in order to make the due date to be short I've used the substring function to just return 10 characters of the date string, e.g. 2019-07-15.lateproject_09.png

Once the two html tables are created, they can then be used inside a Create Email action with headings. We need to expand the advanced options to select for the email to be html.lateproject_10.pngThe flow is now complete, and will now send emails weekly on late tasks.

Conclusion

The list of actions available to Project Online connection is limited so we cannot limit to set assignments but using filter actions a summary can be built.

Thanks for reaading!

 

Comments

Hi

I am loving the fact you are posting flows for Project Online, so good to see the possibilities! Keep them coming! 

Meet Our Blog Authors
  • Working daily with Microsoft Cloud to deliver the needs of my company, my customers and various Microsoft communities and forums. | Office 365 | Flow | PowerShell | PowerApps | SharePoint |
  • Co-founder of https://plumsail.com, Office 365 and SharePoint expert. Passionate about design and development of easy to use, convenient and flexible products.
  • Microsoft Business Apps MVP. Owner of ThriveFast, an Office 365 consulting company.
  • 7x Microsoft Business Solutions MVP (CRM)
  • I'm keen in MS technologies, SharePoint, Office 365 and development for them
  • Daniel is a Business Productivity Consultant & Microsoft Business Solutions MVP who is very enthusiastic about all things Office 365, Microsoft Flow, PowerApps, Azure & SharePoint (Online). Since the preview, Daniel has been working with Microsoft Flow and later on with Microsoft PowerApps. That led to him being awarded an MVP Award for Business Solutions. He loves to blog, present and evangelize about improving productivity in the modern workspace with these amazing tools!
  • Michelle is an Office 365 solution architect in Twin Cities, MN. She has been delivering business collaboration solutions for years with her focus on SharePoint and Office 365. Michelle is a recent board member of the Minnesota Office 365 User Group and has been a member of the SharePoint community since 2009. She is a frequent speaker at MNSPUG and SharePoint Saturday and co-chaired the Legal SharePoint User Group for 4 years. Her most frequent projects have involved rolling out a large deployment of Office 365, SharePoint Online intranet, build of a "CHAMPS" Office 365 user adoption program and most recently, SharePoint On-Premise to Online Migration. Michelle is very excited about cloud technology as it is shifting her IT Pro focus to collaboration strategy and technical adoption.
  • I'm a Microsoft Office Servers and Services MVP with a special interest in SharePoint, Office 365, Microsoft Flow, Microsoft Teams and PowerApps. I work at Triad Group Plc ( https://triad.co.uk)
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor