Search for Help
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
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.
For testing purposes, the “Create Monthly Timesheet Entries” script generates a timesheet entry for Paul Cashmore in addition to creating entries for staff members.
The Timesheet status notification script is configured so that, if any change is detected in the status of Paul Cashmore’s timesheets, only Paul Cashmore is emailed. This enables Paul to test the Timesheets app and associated functions without other user’s receiving email notifications.