Contents
Table of Contents | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Overview
This article outlines how to track time on Task records (Activities) using the Time Tracking (“Stopwatch”) component Stopwatch.
Because you can’t create Task Lookup fields, you can’t create a Task Lookup field on the Time Tracking Summary object, which means you can’t directly link to a Task in the Stopwatch component. To get around this limitation, the Task Link object is used by the component to connect a the Time Tracking Summary record (s) to a Task. By configuring the Time Tracking List component Stopwatch’s properties in a specific way, you can track time against Task records, with the component handling the creation of Task Link records as needed.
Task Links
The Task Link object is used to link a Time Tracking Summary to a Task record. Due to the inability to create a lookup field to the Task object, there is not a direct relationship between the three objects, but rather, when the components properties are configured in a specific way, the component will create a Task Link record and set it as the value for the Task Link
field on the Time Tracking Summary object. At the same time, the Task Link which was that is related to the Time Tracking Summary will also be set as the value for the Task Link
field on the Task object. With the same Task Link set on the lookup field on both objects, they are now connected by being related to the same link.
...
both the Time Tracking Summary and Task records, the Task and Time Tracking Summary are connected.
Configure Stopwatch Properties for use with Task Links
In order to configure the component Stopwatch to track time on Task records using Task Links, the properties of the component need to be configured in a specific way. In the case where you want to track time on the Task object, set the Second Lookup Field and Second Lookup Default Value properties to TTracking__Task_Link__c (TTracking__Task_Link_Object__c)
.
When the properties are configured as outlined above, the component Stopwatch will determine if there is a value in the Task Link
field on the Time Tracking Summary when loadingthe component is loaded. If there is not a value in the field, the second lookup field will instead be replaced with text. On click of the Start button, the component Stopwatch will insert a Task Link record and update the Task Link
field on both the Time Tracking Summary and Task recordrecords. If the Task Link
field is already populated on the Time Tracking Summary, then the Task Link
lookup field will display as normal with the Task Link defaulted in.
...
Configure
...
Stopwatch Properties for use with WhatId & WhoId
An additional function of the component Stopwatch properties when used on the Task object is the ability to default the Second Lookup Field value based on the WhatId
and WhoId
fields on the Task. These fields are polymorphic, meaning they can contain be set to one of many different object types. When chosen in the component properties, the value values in the WhatId
or WhoId
can be defaulted into the Second Lookup Field value, if compatible. The component will get the chosen value from the selected field on the Task object. If the object type of the value is the same as the chosen second lookup field, the value will be defaulted.
For example, let’s say you choose TTracking__Test_Opportunity_Look_up__c (Opportunity)
as the Second Lookup Field and WhatId
as the Second Lookup Default Value. If the WhatId
value on the Task is an Opportunity, then it will default into the Opportunity lookup field on the component, otherwise. Otherwise, it will not default into the field.
...