Submitting timesheets on time are important for tracking projects and performance management. To address the challenge of late submissions, an automated reminder system was created at Mobiz. The system sends Slack messages to users who are yet to submit their timesheets. This blog post discusses how our scheduled job works and its specific code implementation.
Scheduled Job Overview
Here is how timesheet reminders are automated using Slack Integration.
- Name: Slack reminder for timesheet submitter
- Run: Daily
- Schedule: Use the system time zone
- Time: 13:00 hours
- Condition: Excludes weekends
This is an example of a scheduled job that runs daily at 13:00 hours, except on weekends. It checks for users who have pending or recalled timesheets from previous weeks and sends them a reminder via Slack.
Implementation Details
The basis of this implementation is a scheduled job that checks the timesheet database. After analyzing the database, it then identifies all those users who have pending or recalled timesheets. Following is a step-by-step guide about how the script works.
- Condition Check: The first step is to check for the conditions. This verifies that the job runs only on weekdays, and weekends are off.
- Query Pending Timesheets: The next step involves the query that retrieves timesheets that are pending or recalled and groups all based on the user.
- Send Slack Message: It is now time to give the workers a reminder. For each user with pending timesheets, the sendSlackMessage function is called.
Sending Slack Messages
The sendSlackMessage function takes care of the process of sending reminders to users on Slack. Here is a detailed overview of this function.
- Get User Details: The first step is to get user details. User details are retrieved based on their system ID.
- Get or Generate Slack ID: If the user doesn’t have a Slack ID, their email address is used to search for their Slack ID.
- Generate Message: It is time to generate the message now. This function generates a personalized reminder message for each
user.
- Send Slack Message: This function sends the reminder message to the Slack ID of that specific user. If the user’s Slack ID is not already stored, it retrieves and stores it before sending the message.
Example Slack Message
This is how the reminder message appears in Slack.
The message includes a link that directs the user to the list view of their pending or recalled timesheets for previous weeks, making it easy to fill in their timesheet at one click.
Conclusion
By implementing this automated Slack reminder system, Mobiz has streamlined and fast-tracked the process of ensuring timely timesheet submissions. This improves compliance as well as overall operational efficiency. The scheduled job runs seamlessly in the background and takes care of reminders without any manual involvement. This feature helps the human resource team of the company to put their energies on other important tasks. Contact us for more.
Empower Your Business with Our Innovative IT Solutions!
- Cloud Services
- ServiceNow Integrations
- AI Implementation on Azure OpenAI
Join the newsletter!
Data insights and technology news delivered to you.
By signing up for our newsletter you agre to the Terms and Conditons