Microsoft Roadmap Flow Deep Dive Part 1

Microsoft announced a couple of great new developments during last years Ignite (you can read more about it here). And for Microsoft Roadmap, time has come to start playing around! For a full video on the feature release you can find it on the TPC YouTube channel.

This two part blog post will take a close look at the Microsoft Flow content that comes with the new Roadmap feature. There are two versions of the Flow, one for a connection with Project Online and the second will connect Microsoft Roadmap to Azure Boards.

A small warning up front

As Project Online consultants we might feel like kids in the candy store, Microsoft Roadmap connects multiple sources and creates a great overview for the Portfolio/Program Manager. And with Flow you have a powerful automation tool (haha see what I did? Because it’s part of the Power Platform?).

But, when we started connecting with Roadmaps using Flow, it destroyed the full Roadmap functionality. Until we removed the connection with Roadmap from the custom Flow.

The Project Online Roadmap flow

Microsoft Roadmap Project Online Flow Collapsed

Don’t worry, the above picture is supposed to be unreadable. But this is the full Flow that governs changes in the Roadmap Items linked to Project Online.

In a nutshell what the Flow does is as follows:

  • Check every five minutes if the project still exists.
  • If it doesn’t (or appears to) exist it will follow the right lane.
  • If it does exist it will follow the left. And it will check if there are any changes to the Task items linked to Roadmap Items.
  • If there are changes it will update the name, start and finish dates and it will move on to the next task until the Flow ends.

Something that you might also notice from the detailed images below is the suffix “(Preview)” behind all the Roadmap related actions/triggers. Because of the newness Microsoft is still testing them on a large scale. At some point the actions and triggers will come out of preview, basically meaning that they are more stable. It could also mean that more/better functionality is added.

The Deep dive

But wait! This is a deep dive article. So let’s have a look at the details of the Flow, in order to better understand it. Here’s the first part in more detail:

Microsoft Roadmap Flow detail 1

The Flow starts with a Recurrence item (set to 5 minutes). After that there are four variables set, linked to the Roadmap, the Common Data service (where roadmap lives), the Project Online URL and the Project itself.

The last part pulls current Project ID (or ProjectServerProjectId as it’s called in the picture above) from the list of projects from the PWA instance (or ProjectServerPwaUrl as it’s called in the picture above).

Then, if the List project step fails or times out, the right lane in the Flow takes effect.

Now here things get a bit technical. And from what I understand the Flow picks up the Error message in the Parse JSON and translates it to an error code in “Initialize Error”. Then there’s a test to know if the error is due to “a lack of the Project being there” or some other errors. Here’s the code from the Test error code:

{"and":[{"not":{"equals":["@body('Parse_JSON')?['odata.error']","@null"]}},{"contains":["@body('Parse_JSON')?['odata.error']?['code']","@string(1000)"]}]}

This results in two error codes where if the above is true it will return “4” as the error code, where it will return “1000” if it’s not true.

The last two items in this lane describe a error log and the termination of the flow. Microsoft Flow will be “Succeeded” because everything within the flow went alright. But there will be an error message in the Roadmap when you open that up.

Taking the left lane

If the Project does exist, and you do have permissions to view is (using the Flow credentials), Flow will take the left lane to proceed. Here’s the first bit:

This part is easy. The first item creates a “Ticks” of “Now() minus 15” minutes. Where the second creates a “Ticks” or the last published date (and time) from Project Online. The test then sees if the last published date is older than the current time minus 15 minutes.

{"and":[{"less":["@outputs('LastPublishedDate')","@outputs('Interval')"]}]}

So if the Project wasn’t published in the last 15 minutes the Flow will terminate (in the If Yes statement). If the project was published within the last 15 minutes we will continue with:

The Flow picks up the RoadmapID (again, because it also had the value in a variable at the beginning) and uses the output in another test:

{"and":[{"not":{"equals":["@variables('ProjectServerProjectId')","@body('Read_PortfolioLink_')?['externalProjectId']"]}}]}

If this test is True there is a mismatch between the Project Online GUID and the “externalProjectId” and the Flow fails. If the test is False we continue on our path with an item that sets the Roadmap item (or PortfolioLink as it’s called in the Flow) as refresh in progress which is RefreshStatus 1 if you were wondering.

After that it reads the RoadmapItemLinks within the portfolio and there’s a batch processing integer of 30. Then the following happens:

The Flow builds up a understanding of the number of items to be refreshed. It creates a array to store data in and set’s the refresh status to 0. This part finishes with the if test where the Flow continues with the True statement until all items are refreshed (ending with 0 ItemsToBeRefreshed).

{"and":[{"greater":["@variables('ItemsToBeRefreshed')",0]}]}

Now for the last part we are going to dive into the situation where there is still an item to be refreshed:

No, sorry. This is too much detail. Let’s just keep it at semi high level here:

That’s better. So the previous picture was all the detail that I expanded when clicking on the Process batches (brown) item. It’s safe to say that a lot happens. But here’s the short version:

The process starts with a select, where a number of items are gathered from Roadmaps: RoadmapItemId, ExternalTaskId, ExternalName, ExternalStartDate, ExternalDueDate, There’s a CSOMFilter value stating “id eq guid”ExternalTaskId” and finally Id.

In the second item it set’s the variable to be updated. And then the batching process starts (in a previous section the batches were set with 30 items at a time).

Within the batch process there’s a counter that increases each time an item has been refreshed. There’s a condition that finds out if a task was deleted from the Project in Project Online. There’s another test that finds out if that specific task/item has changed and if that is true we end up with:

Above picture shows the subsection that is responsible for setting the new external name, start and due dates.

For each item that is processed we end up with an error (which results in a RefreshStatus 3) or a successful refresh with status 0.
Thereby ending the Flow.

Final notes

This article got more technical than most of my items on the blog. However I thought it would be nice if there was a general overview on what the Microsoft Flow for Roadmap does when it’s linked with a Project Online project.

I really like what Microsoft created with Roadmap. It’s an interesting and simple to use solution for portfolio managers. If you haven’t yet, I would like to encourage you to watch my “first impression” video.

In my next post I’ll take a closer look at the Roadmap Flow that is created when we connect to a Azure Board.