It’s been a while since I posted part 5 in this series but here is part 6. I had the blog post written a while ago but not had time to finalise it and publish. In part 6 we will look at adding an example business process flow and business rule into the example app. In part 5 we covered adding new entities into the app with examples of data roll up, examples for hooking into Power Automate flows to run actions and creating a project status report in Microsoft Word. If you missed part 5, it can be found here: https://pwmather.wordpress.com/2020/01/09/extending-projectfortheweb-part5-ppm-cds-msdyn365-powerplatform-msproject-powerapps-powerautomate/
The updated app can be seen here to show the process flow for the projects – an example project stage process:
For Complex Project Types there is an additional stage “Planning Review”:
A new tab on the Project form to show the Stage comments:
Then the conditional field – the example is based on the “Estimated Cost” field, if the “Estimated Cost” is below 30,000 the “Cost Justification” field is not required:
If the “Estimated Cost” is above 30,000 then the “Cost Justification” is a required field – notice the red asterisk:
Firstly lets look at the example business process flow. I added this via the App designer, click Business Process Flows and the right hand panel will update to show the available process flows and a create new option:
Click Create New and complete the form:
Click OK to load the business process flow designer:
Now design the process required using the components – drag them onto the canvas. As this example is based on a project stage process, firstly I created the stages I wanted by dragging the Stage component on the designer then renaming the stages:
As you can see currently the flow is:
Initiation –> Planning –> Planning Review –> Execution –> Monitoring –> Project Closure
For every stage, I created a new field in the Project entity to capture comments for each stage, so I have 6 new fields. I called these “<stage name> Stage Comments”. I also updated the project entity form to add a new tab to display the stage comments but as the steps to add fields and update forms are covered in previous posts, I wont cover those again here. Click the Details dropdown and click the Data Step then in the Properties panel select the new comments field / or other fields you want captured at the Stage, I also made this field required:
Click Apply and repeat for other stages as required. I now want to make the Planning Review stage conditional based on the “Project Type” field, if it equals "Complex" then the process goes to “Planning Review”. To do this I added in a Condition component between the Planning and Planning Review stages:
As seen above, if “Project Type” does not equal Complex the process goes to the Execution stage else the process goes to the “Planning Review” stage then Execution stage. You will also need to add the “Project Type” into a data step in the Planning stage as seen below, this applies to any other field that is used in the condition component:
Now Save the process flow and it should validate. Click Activate to enable the process flow, click Activate on the confirmation. Close the business process flow designer window, now on the App Designer enable the new business process flow:
Then save, validate and publish the app as before. Now run the app, create a new project and you will see the business process flow attached. This is a simple business process flow example, you can easily add in custom actions, workflows or trigger Power Automate flows to enhance the process.
The next feature added was an example business rule to control if a field is required or not. For this I created a new field in the Project entity called “Cost Justification” as seen below:
This is set to not required, save the entity then click Business rules and click add. Give the rule a name and description. Click the condition component then complete the properties – here is my example:
Here I set an expression for the “Estimated Cost” field is greater than 30,000. Then add the new “Set Business Required” action to the design canvas:
Here I set the “Cost Justification” field to be required when the condition check is true. Save, Validate and Activate the business rule and close the window / tab. Add the new “Cust Justification” field to the Project form and Publish:
Now access the app and you will see the new project “Cost Justification” field required / not required state is controlled by the business rule set on the “Estimated Cost” field.
That’s it for part 6, some simple examples to extend Project for the Web using the power of the Power Platform by adding some governance controls to your projects via the business process flows and business rules. In part 7 we will look at more examples for adding features to Project for the Web.