MS Flow 08 – Timesheet check for Project Service Automation (PSA – Microsoft Dynamics 365)

Losing a lot of time by checking everyone’s timesheet if the work week has been completely registered in the PSA timesheet portal. In Belgium, most of the employees have 40 hours working week. In this MS Flow, a check will be performed every Friday evening around 8 PM. 

Set time schedule

Defining some variables that later will be used during the calculation of the timesheet total hours and to send a notification to the employees.

Variables

In the example, the work week is starting on Monday at 8.30 AM and end on Friday at 5 PM. To define the date on Friday, “Date Time” – actions will be used to get the current date and time. This will reflect the date on this Friday that the Flow is running.

Date Time – Action (Current Time)
Getting the date time that the Flow has being started.

Getting the date and Time before Monday morning, so that when filtering the time registration of the complete week will be selected.

Set begin date and time

To get all the employees that need to be checked, the “comma Data Service”- connector/action will be used.
The action “List records” will be used the get all the record of each employee.

PSA Users – getting employee records

After collecting the first information, check of the timesheet for an employee can be started. Process 05 – Check timesheet employee” will handle the work. Six steps in the “apply to each” – loop will calculate the total hours in registered for an employee and sent a notification when needed. Let’s look deeper into the process.

Process calculate registered work hours and notify as needed.

The first step of the process is getting the Employee Name (Because in PSA the employee/user is a unique number). The name of the employee can be found in the Entity “PSA Users”, under the field “psa_name”. This value will be set into the variable “EmployeeName”. 

Set variable EmployeeName

The second and third step will get the employee e-mail address and this can be found in the entity “Users”. This entity contains detailed employee/user information.

The output value will contain the Primary E-mail address of the employee/user (field “internalemailaddress” in the entity Users), this value will be set to the variable “EmployeeEmail” The fourth step in the process will be filtering the weekly registered hours out the entity “Hours”. 

Filtering registered hours

The fifth step of the process will be calculating the total amount of registered hours in the week.

Calculate Total Hours

Getting the hours will result in output as a string (example 1.5). This need to be converted to a floated integer value, before adding to the number variable that has been defined upfront, see screenshots below. 

The calculation in detail:

Process calculation details

In the last two steps, the total amount of hours will be check if there is a minimum of 40 hours registered, when not email notification will be sent to the employee/user to review his weekly time registration. The total hours variable will be reset to zero for the next check for another employee/user.

Total overview of the Flow, see below.

When questions or remarks please feel free to contact me and like my blog if you think it’s great.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.