Help Center
< All Topics
Print

Overview

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
All Azure runbook scripts can be viewed via the following link: Azure RunBooks Home, then selecting the appropriate runbook name. 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 a schedule – having selected the relevant script, click the see the “Schedules” link on the left hand side of the view. At the time of writing, the schedule runs once per week. The script generates a log file which can be checked for errors.

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.