Help Center
< All Topics


This script monitors Timesheets for any status change and performs various notification actions, depending upon a timesheet’s previous status and its new status

Where to Find It

Name of runbook: TimesheetStatusNotification
The script can be viewed and edited via the following link: TimesheetStatusNotification. The script is hosted in the cloud, using Microsoft Azure, because it is run on a scheduled basis.  See the following document (advanced users only!!) regarding how the script was initially created in the Azure environment: Creating a PowerShell script in Azure
This script is scheduled to run using schedules which can be viewed via the following link: TimesheetStatusNotificationSchedules. At the time of writing, each schedule runs hourly: one runs on the hour and the other on the half-hour. This ensures that the script runs every half-hour. This approach is necessary because Azure runbook schedules have a  minimum frequency of one hour. The script generates a log file which can be checked for errors. This can be seen here: TimesheetStatusNotification log files

How it Works

The script reads the “Timesheets” Sharepoint list and retrieves those list items where the modified date is greater than the last time the script was executed. For each changed item, the script checks if the status column value has changed and performs different actions. e.g. if the previous timesheet status was “Not Submitted” and the new status is “Awaiting Approval”, an email is sent to a distribution list (Timesheet Reviewers) to tell them, so that they can check the timesheet entries and approve the timesheet. Take a look at the script for more details of what actions are taken.
The statuses are read from a “TimesheetStatusHashMapAsString” Azure environment variable – see Azure Environment Variables. Once actions have taken place, the timesheet statuses are written back to this variable. Similarly, a time value is written to the  “lastTimesheetChangeTime” variable – it is this value that is used to determine the last time the script was executed.