Custom Start and End Date Time Fields
This feature is used if you want to add Start and End Times to the Easy Calendar or Batch Entry. Stop watch will automatically log the Start and End Times in the Time Tracking object records.
Note: This is a workaround. Start and End date fields are not a native function of Time Tracking and by creating separate Start Time and End Time fields you will need to create a formula field to use this new field to calculate the hours or the Hours (As Number).
This documentation assumes you have already created a Start Time and End Time (Time/Date fields) on the Time Tracking Summary object.
🛠️ How-To: Create a Salesforce Formula Field for Calculated Hours
This document outlines the steps to create a custom Number formula field with two decimal places. This field will calculate the difference between two DateTime fields (Start Time and End Time) and convert the result into total hours. If either DateTime field is blank, the formula will instead use the value from an existing Hours (Number) field.
1. Understand the Core Formula Logic
Salesforce stores the difference between two DateTime fields in days. To convert this difference into hours, we need to multiply the result by 24 (hours per day).
The overall structure of the formula will be:
Check for Blanks: Use the
ISBLANKfunction to see if eitherStart_Time__corEnd_Time__cis empty.Fallback Value: If they are blank, use the value from the existing
TTracking__Hours_Number__cfield.Calculation: If they are not blank, calculate:
(End_Time__c - Start_Time__c) * 24.Format: Ensure the output is a
Numberwith 2 decimal places.
2. Formula Setup Steps
Step 2.1: Navigate to the Object Manager
From Setup, enter Object Manager in the Quick Find box.
Select the Object where you want this formula field (e.g.,
Case,Custom Object, etc.).
Step 2.2: Create a New Field
In the selected Object, click Fields & Relationships.
Click the New button.
Choose Formula as the Field Type, and click Next.
Step 2.3: Define the Formula Field Details
Field Label: Enter a descriptive name (e.g.,
Calculated Hours).Field Name: (This will auto-populate, e.g.,
Calculated_Hours__c).Formula Return Type: Select Number.
Decimal Places: Set this to 2.
Click Next.
Step 2.4: Enter the Formula
Enter the following formula into the editor. This formula uses the IF and ISBLANK functions to implement the fallback logic.
Note: Replace
Start_Time__candEnd_Time__cwith the exact API names of your fields.
Code snippetIF(
OR(
ISBLANK(Start_Time__c),
ISBLANK(End_Time__c)
),
TTracking__Hours_Number__c,
(End_Time__c - Start_Time__c) * 24
)
Step 2.5: Verify and Save
Click Check Syntax to ensure the formula is valid.
(Optional) Click Add Description and Add Help Text for documentation.
Click Next.
Step 2.6: Set Field-Level Security
Set the Field-Level Security for the new field for all necessary profiles (typically Read-Only access for a formula field).
Click Next.
Step 2.7: Add to Page Layouts
Select the Page Layouts where you want the new field to be displayed.
Click Save.
3. Add the new field to Reports
Ensure you add this new Calculated Hours field to the necessary reports and or list views and page layouts in Salesforce.
This is not a supported feature of Time Tracking and is individually customized per Salesforce org, so it is not included in your subscriptions support.