At the recent Microsoft PPM Summit in Prague last week, Chris Boyd from the Microsoft Project Product team demonstrated syncing the Roadmap row item status with the task status from the Project Online schedule. This was done using compiled code in a console application which worked well. I set myself a little challenge to do something similar but all from Microsoft Flow. Being a public holiday here in the UK, I found an hour spare today to tackle this. In this blog post I walkthrough the Flow actions required to do this. A summary image can be seen below:
As you can see, this flow is triggered on a Project Online Project Publish. I then execute a REST query on the Project Data API using the send an HTTP request to SharePoint action:
I pass in the published project ID and select the TaskID and the custom field I’m using to set the Roadmap row item status. I created a custom field called “Roadmap Health” that was a lookup with the same status values as Roadmap but you can use any field and values, just update the query and Flow Switch action as needed.
I then create a new variable called “Health” and set the Type to an Integer:
I then add an Apply to each action and pass in the body(‘GetTaskHealth’)[‘value’] expression to use the output from my REST call:
I then have a condition check action to check for null values in the Roadmap Health field, the expression for the field is items(‘Apply_to_each’)[‘RoadmapHealth’] then null is also added via an expression:
You could remove the need for the condition check by filtering out the nulls in the REST call. If this is false, nothing happens as there is no status to sync, if this true the next action is a Switch, the field I’m using in the switch is referenced using the expression: items(‘Apply_to_each’)[‘RoadmapHealth’]
Then for each possible value from the task level custom field you are using, map this to one of the Roadmap status’ by setting the Health variable, for example, when the Roadmap Health task field value is equal to “On Track” I set the variable to 0:
The Roadmap status enumerations are below:
- On Track = 0
- Potential Problem = 1
- At Risk = 2
- Complete = 10
- Not Set = 100
Once that is completed for all possible outcomes, the next action is the List records Common Data Service action:
Here the Flow returns the Roadmap Item Link record for the TaskId passed in, the TaskId is referenced using the following expression: items(‘Apply_to_each’)[‘TaskId’]
The next action is another Apply to each action, Flow does this automatically as the List records would typically return more than one record:
The output used for this action is the default List records value from the Dynamic Content option. Then the final action within the Flow is the Common Data Service Update a record:
This action updates the Roadmap Items, I then pass in the List records Roadmap Item value from the Dynamic content panel, this is the Roadmap Item Id value. I also pass in the Health variable in the “Health Status Value” field. The flow will loop through all Project tasks and update the equivalent Roadmap row item status, pretty simple for a no / low code solution using only Microsoft Flow!
Over the next few days I will publish a short video for this Flow on my YouTube channel and also probably provide a download link for this Flow template to help as a solution starter.