Flow example: Upload images to ProjectWise using Microsoft Flow

This post will show how to create a flow for uploading an image document to ProjectWise Design Integration datasource.

The flow will be used to quickly create a document from an image using a mobile phone. Let’s say there is an engineer who does field visits, he needs to load many pictures efficiently and then inform other teams members about new uploads. Without flow this task would require several steps, such as choosing a destination folder, filling document attributes, sending an email about the upload. This flow demonstrates how to simplify this action to just a few clicks.

ProjectWise Setup

Let’s use sample project BSI400 from ProjectWise sample dataset. The BSI400 project must be associated with a cloud project and a connection was created. To learn how to do this go to Preparing ProjectWise for Flow.

There are three folders for images in the project. The flow will have a preset to add an image to each folder quickly.

 

We need to know the following information to be able to create documents in these folders:

  • Name of preset
  • Path to images folder
  • List of people to notify

To make the flow more flexible let’s store this information as documents in ProjectWise . This way it can be modified at any time as needed. We have created a new environment ‘Flow Automation’ with two attributes for path and people. Name of preset will be document name.

 

Creating a Flow

Now let’s create a new flow. Each flow starts with a trigger. In our case it will be a mobile flow button trigger. To do this:

  • Go to flow.microsoft.com
  • Choose My flows
  • Click Create from blank.
  • Scroll down and click ‘Search hundreds of connectors and trigger’
  • Choose Flow button for mobile

 

Pick the only available trigger ‘Manually trigger a flow’. Use ‘Add an input’ to create a text input with picklist containing preset names (the text here must match file name in automation folder exactly) and then add an image file input:

Reading preset information

Next, let’s find a preset document to retrieve destination path and list of people to notify stored there. Click +New Step, search for ProjectWise. This will show all actions available with ProjectWise:

 

Choose ‘Find a document by path or GUID’ action. This will add a ProjectWise action to the flow. All ProjectWise actions require a ProjectWise Cloud project and a Work Area Connection (the first two parameters).

The third parameter is a path to the document. Let’s construct it as a concatenation of a known path to a automation folder (‘./99_Automation/Flow Image Upload/’) and name of preset, taken from the mobile button trigger.

The last parameter tells Flow about the environment of the document, so it can return correct attributes. Attribute values will be used as inputs to other actions.

Creating a new document

The next step is to create a name for the new document and file. To keep it simple I will name it using a time stamp. Let’s use ‘Compose’ action from ‘Data Operations’ and a couple of functions for this.

Enter this expression to input of compose action: formatDateTime(utcNow(), 'yyyyMMddHHmmss'). This function will generate a timestamp string suitable for file name looking like this: 20181009111942.

 

Now we have all the information needed to create a new document. Let’s do that! First find a ProjectWise action called ‘Create a new document’ and then pick project and connection. Then fill in the general document properties:

  • Folder: take the Path attribute from the preset document attribute Path retrieved in previous step. (prefix it with ‘./’)
  • Document name is an output of compose action
  • File name is also an output of compose action plus an extension
  • File content is Picture output from flow trigger

Notifying interested parties

Now once the document is created, let’s send an email notification. Let’s use Office 365 Outlook action ‘Send an email’.

  • To: The recipients is a semicolon separated list of emails from the preset document attribute ‘PeopleToNotify’
  • Document name was used in the subject.
  • The email body will contain links to document in ProjectWise and in Share
  • Do not forget to set parameter Is HTML to Yes

It is now time to save and run the flow!

Variations

This example suggests storing preset information in ProjectWise. For this we have created a new environment. In many cases creating of a new environment is not desired. Possible alternatives are: using any other already existing environment to store this information, reading present information from Excel spreadsheet stored in OneDrive or SharePoint.

Summary

This post demonstrated how to use ProjectWise Flow connector to create new documents and how to store additional information required for Flow to run in ProjectWise.

Anonymous