PK4 TimeTracker includes two services for automatic invoicing:
- A service that generates Invoices from all Time Details logged for the past month, with one Detail per Project on each Invoice
- A service that emails approved invoices to the relevant Contact on the Accounts of those Invoices.
To send out invoices automatically, you need to create Salesforce Schedulers for each of these services. Let's see how you would do that.
Creating Invoices
- Click on Setup
- Search for Apex Classes in the Quick Find,
- Click the Schedule Apex button
- Enter a Job Name (You can name it as Create Invoices)
- Select "InvoiceQualifiedAccountScheduleClass" for Apex Class,
- Select the Frequency, the day you want to grenate the invoices,
- Start and End date, and the preferred Start Time for the scheduler
- Click the Save button.
- Now the invoices will be generated automatically according to the frequency you setup.

Sending out Invoices
- From the Setup menu, search for Apex Classes and click on Scheduled Apex.
Enter the Job Name as Send Invoice and select SendInvoiceToContact in the Apex Class.
Choose the desired frequency and date for sending the invoice emails, then Save the schedule.Once this is configured, the invoices will be generated and automatically emailed to the respective Contacts.

Some things to remember
- All the time entries made using TimeTracker apps, like the TimeTracker Mobile app, TimeTracker Web app, Track time in Salesforce, etc., are all available to invoice.
- The CreateInvoices scheduler creates one Invoice Header per Account and then merges the hours from relevant Time Details of a Project into each Invoice Detail.
- The Invoices are created at the time that is selected in the Preferred start time in the Header scheduler.
- The Invoice is sent to the Invoice Contact on the Account of each Invoice.
- Users can review generated Invoices on the Invoicing tab in Salesforce.
- The Invoice is sent at the time that is selected in the Preferred Start Time in the Send Invoice scheduler.
- You can create Invoices manually, too. And they will be emailed along with the auto-generated Invoices.
Note: We suggest that you add at least a couple of days between the dates of Invoice creation and sending the Invoices. That way, you/someone other user can verify the invoices that are generated, make the changes if any, and save them. The SendInvoices scheduler will thereafter, automatically email the invoices.