Salesforce does not support tracking time to an external system. However, this can be achieved by activating the Auto Tracking Lightning Component and by adding a Trigger as described below.
Auto Tracker on the Contact Page
Step 1: Enable Auto Tracking. Click here to learn more about adding the Auto tracking component to an object in your org.
- Auto Tracker can be added to any object in Salesforce. For demonstration, we’ll use Contacts as the example object.
Auto Tracker on the Contact Page with Hidden Timer
In this approach, the Auto Tracker is added to the Contact object, but the timer is hidden in the UI. While invisible to users, the timer continues to track time in the backend.
Step 1: Track Actions via Click Events
Set up handlers to monitor user interactions, such as:
Creating/editing records
Composing emails
Creating Tasks or Events
Adding Case Comments
Each of these actions will be tracked separately in a custom object: Sub-TT Event Details.
Step 2: Trigger on Task Object
Create a trigger on the Task object to:
Query active TT Detail records.
Create and link a Sub-TT Detail record containing time tracking data.
Required Fields in Sub-TT Detail:
Start Time: When the interaction (e.g., a call) started.
End Time: Start time plus duration (in minutes).
TT Detail: Reference to the active time record.
TT User: Mapped from Salesforce User to TT User ID.
Contact (Optional): From the Task’s
WhatId
.Lead (Optional): From the Task’s
WhatId
.Task ID: Stored as a text field for reference.
Once the Auto Timer is enabled and the trigger is added to the org, the time spent on a call will be automatically tracked, and the TimeTracker (TT) details will be created with all relevant information.