Building a #PowerApps app for #MSProject data Part 2 #SharePoint #PowerPlatform #PowerAutomate #LessModeMorePower #NoCode #CDS #Office365

This is part 2 of the mini series I started on extending the capability of Microsoft Project using the Power Platform. For those organisations using the “Sync with SharePoint” option for Microsoft Project and sync all projects to sites in the same site collection in Office 365 – this provides an option for adding capabilities to your PPM tool to build a central application. If you are not familiar with this feature in Microsoft Project – details can be found here: https://support.microsoft.com/en-us/office/sync-with-a-sharepoint-tasks-list-fb956d2c-723d-4d5a-b7e5-710ef82aa27a. If you missed part 1 it can be found here: https://pwmather.wordpress.com/2020/04/16/building-a-powerapps-app-for-msproject-data-part-1-sharepoint-powerplatform-powerautomate-lessmodemorepower-nocode-cds-office365/

In part 1 we had a quick intro to the solution which was a model-driven Power App, if you are not sure what model-driven Power Apps are, start here: https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/model-driven-app-overview. In part 2 we will look at the entities used in the Power App, building the basic app and then start to walk through the example Power Automate Flow that syncs the data. Firstly navigate to https://make.powerapps.com and click Solutions as the first thing to do is create a new solution. This is the container for the app components – to read more about solutions see this link: https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/solutions-overview. Create a new solution using the right hand panel that appears – my entity was called MPP Project. Then when in the newly created solution, click New > Entity and complete the form on the right hand side – this will be for the project level data. Call the Primary field “Project Name” – this will hold the SharePoint task list site title. An Entity defines the fields, the views, the forms etc., these are used to manage the data. The entity will then display with the standard fields and the primary field. Use the “+ Add Field” button to add the remaining fields. For this example I’ve created the following:

  • Task List URL as a URL field – this will hold the link to the SharePoint task list for the project
  • Project Description as a Text Area field – this is an example custom field used / editable in the app

Other fields will be created in a later post. Save the Entity. You will now have the following:

App1

Click Views in the entity navigation then click Active MPP Project. Now drag the fields from the left panel onto the view as needed, something like this:

App2

Your view will be empty at this point, mine has data in. Save and Publish the view then click the “<—Back” button. Update / create other views as needed but we will cover that in a later post. Now click the Forms navigation option then click the Information Main form. When this loads add the Task List URL and Project Description fields to the form like below. I’ve also hidden the system Owner field:

App3

I have also locked the Project Name and the Task List URL by selecting the fields and setting the Read-only field option. I have done this as these details are synced by the Power Automate Flow that syncs the data from SharePoint Online to the entity so I don’t want the users editing this. Save and Publish the form. Click the Back button then go to the solution. Now create another entity in the solution, I called this one MPP Task with a primary field “Task Name” – this will hold the Task Name from the SharePoint Task list. Use the “+ Add Field” button to add the remaining fields. For this example I’ve created the following:

  • Start Date as a Date and Time field – this will hold the task start date value from the SharePoint list
  • Due Date as a Date and Time field – this will hold the task due date value from the SharePoint list
  • Percent Complete as a Decimal Number field – this will hold the task % complete value from SharePoint list
  • Status as a Text field – this will hold the task status value from the SharePoint list
  • Related Project as a Lookup – this is a lookup field to the MPP Project entity
  • SyncedProjectGUID as a Text field – this will hold the project GUID from the SharePoint list
  • TaskGUIDSharePoint as a Text field – this will hold the task GUID from the SharePoint list
  • TaskUIDSharePoint as a Text field – this will hold the task UID from the SharePoint list
  • Highlight as an Option Set field – this is an example custom field used / editable in the app

Other fields will be created in a later post. Save the Entity. You will now have the following:

App4

Similar to the MPP Project entity, update the views and forms on the MPP Task entity. For example, a view (yours will not have data at the moment):

App5

The form – the same as the MPP Project forms – I have hidden the system owner field and set the fields that will be populated by the Power Automate Flow to Read-only.:

App6

Now go back to the solution and open the MPP Project entity and load the Main form and add a 1-column tab from the components list – call this tab “Tasks”. Then add the Subgrid component into the new Tasks tab section – when prompted select the MPP Tasks entity and the correct view and check the “Show related records” option:

App7

Update the various properties such as labels and names as needed:

App8

Then save and publish the form. The next part is to create the model-driven app. Back in the solution click New > App > Model-driven app. Complete the form providing a name and description and click Done. The App Designer will now load:

App9

Click the Site Map to launch the Sitemap Designer:

App10

Update the area, group and sub areas properties as needed. On the sub area set this the Type to Entity and select the MPP Project entity:

App11

Save and Publish the site map then save and close. In the App Designer click Save then Validate then Publish. Once completed click Save and Close. Your solution will now consistent of the following components:

App12

The final component is the Power Automate flow. Click New > Flow to launch the Power Automate flow designer canvas:

Flow1

Give the flow a name by clicking “Untitled”. In the trigger input search “scheduled” and select the “Recurrence” trigger and set the trigger as needed – this controls how frequently the data from the MPP projects in SharePoint Online will sync to the entities we have created:

Flow2

*****Update 27th April 2020****

I have changed the way the Flow works to simplify it I whilst looking to support another scenario – see part 3 for the remaining flow steps https://pwmather.wordpress.com/2020/04/27/building-a-powerapps-app-for-msproject-data-part-3-sharepoint-powerplatform-powerautomate-lessmodemorepower-nocode-cds-office365/

*******************************

Next add a SharePoint HTTP action to query all of the SharePoint sites in the specified SharePoint Online site collection that are using a “PROJECTSITE” template:

Flow3

In the site address set the site collection where the Microsoft Project task list sites exist. In the Uri input add the SharePoint REST query that will return the sites and add the headers as seen above. Next add an “Apply to each” action and pass in the data returned from the SharePoint HTTP action – in my example this is the “GetAllProjectSites” action, then inside the “Apply to each” action add another SharePoint HTTP action – this action will retrieve all of the Task data from each of the project sites:

Flow4

To pass the data into the “Apply to each” action, which I have renamed to “ForEachProjectSite”, use an expression as seen below:

Flow5

Then dynamically pass in the Site Address in the 2nd SharePoint HTTP action, which I have called “GetProjectSiteTasks”, using another expression:

Flow6

In the Uri input add the SharePoint REST query that will return the tasks and add the headers as seen above. Now add another action, this time a Common Data Service (CDS) list records action to query the MPP Projects entity – I renamed the action to “ListRecordsFilteredToProject”:

Flow7

The query is filtered for the current Project site title using the expression “items(‘ForEachProjectSite’)?[‘Title’]” – this would need to be updated to the correct name of the 1st SharePoint HTTP action and correct the single quotes – so copy and paste wont work. This action is used to check if the current project site exists in the MPP Projects entity. Then add a Condition action to check if the project does exist by checking the length of the output from the “ListRecordsFilteredToProject” action:

Flow8

Then based on the condition, if it is true, the project already exists so the flow then updates / adds new data as needed whereas if the condition is false then the project doesn’t yet exist in the MPP Projects entity so the flow would then create it. There are a few more actions in the Power Automate flow but that is it for part 2, in Part 3 we will continue exploring the Power Automate Flow that is used and then look at extending the example model-driven app to give additional features. Look out for part 3 coming soon.

Comments are closed.

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: