Coding Workshop: Automate Email Delivery of Timesheets to Clients

| Time to read: 12 minutes

Coding Workshop: Automate Email Delivery of Timesheets to Clients


In this article, we will explore a common automation task: automatically sending information. As an example, let's examine how to send a scheduled list of timesheets in a hypothetical business application.

Let's assume that we already have a list of timesheets containing the following information: date, employee, and billing time. For this example, we'll keep it simple, focusing on the process rather than the realism of the task.

Our goal is to process the timesheets once per month, group them by client, and send them to clients in PDF format.

This task will take us through several Every8.Cloud modules.

Preparing the Timesheets to Send

We want to send the timesheets grouped by clients. We assume that we already have a list of timesheets and a list of clients in our system or their alternatives.

First, let's create a list that will store the information to be sent.

We will create a list with the following structure:

  • Date: date
  • Client: reference (Clients)
  • File: file (this will be our PDF file to be sent)

Let's call this list Timesheets to Send.

We also need to create a Tabular input to reference the timesheets to be sent. The tabular input name can be Timesheets and it will contain only one attribute called Timesheet, which will have a referential data type to the list Timesheets.

Designing the PDF Layout

We want to send a visually appealing PDF file with our logo and phone number, right? Let's design it to our liking.

Go to the Print forms tab and create a new print form Timesheets (this topic could be the subject of another article).

Customize it as desired.

Creating the Scheduled Job

The next step is to write a script to populate this list regularly. Let's assume that we want to send it automatically once a day.

We will create a new scheduled job called Send Timesheets to Clients, define the schedule, and define the business logic.

This script will extract information from the timesheets and create new objects in our new list.

The last lines of code create the PDF file and attach it to the data object. That file will be sent.

To manually test the scheduled job, go to the implementation layer and run it manually.

This process will create our batches to be sent.

We're almost there!

Sending Emails to Clients

The last step is actually sending the timesheets to the clients. To do this, we will create a trigger that sends the email. It can be created in the Application builder or directly in the Implementation layer.

The scheduled job will create data objects and PDF files, while the trigger sends them by email.

And that's it!

You've successfully automated the delivery of timesheets to clients via email using Every8.Cloud.

All articles Share this post:

Every8.Cloud Product Tour Request

Let’s get started!

{{ vars.errorMessage }}
{{ vars.successMessage }}