Tested on:
Dynamics 365 CE version 9.1, Project Service Automation solution version 3.1, Unified Interface
I have previously written a blog post about preventing Time Entries in Dynamics 365 Project Service Automation when a resource’s Project Team Member Role is different than the Role being used for a Time Entry. Another requirement that occasionally comes up is preventing Time Entries when a resource selects a Role that is not defined for him/her on the Bookable Resource Category Assn entity. To fulfill this requirement we need an option set on Time Entry, a real-time workflow and a Flow. Let’s go through the steps to build the functionality:
1. Create an option set that has Yes/No as options. Place the created field on the Time Entry form. This option set will change to Yes if a Role selected for a Time Entry will match a Role defined for a Bookable Resource under the Bookable Resource Category Assn entity. The Flow in step 3 will change the value on the option set.
2. Create a real-time workflow that prevents a Time Entry from being submitted if the value on the option set is No. When Roles don’t match, an error is displayed.
3. Create a Flow that updates the option set created in step 1 to Yes if the Role on a Time Entry matches a Role on Bookable Resource Category Assn.
The purpose of this article is to give ideas about how Time Entries can be controlled and what can be achieved with Flow without using code. Do note that as Flow does not execute in real-time, you may run into challenges if Time Entries are submitted before the Flow has run or if the selected Role is changed after the record is created. A separate Flow can be used for updating the record when using a CDS connector or you can also choose to use the Dynamics 365 connector as it fires off on both create and update. Feel free to download this Flow from the Those Dynamics Guys PowerApps Bank here.
Disclaimer:
All my blog posts reflect my personal opinions and findings unless otherwise stated.