Overview
With the use of our provided Flow Templates, you can roll-up Time Tracking data to related objects. In this document, we’ll outline how this functionality can be used to allocate time for specific records, and report on it.
Contents
Table of Contents | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Allocation Fields & Usage
These fields have already been created on the Opportunity and Case objects, so see those as an example if needed.
To track allocated time on records related to Time Tracking Summary record’s, you first need to make some new fields on the source object (the object related to Time Tracking Summary). In total, you will need six fields per object. See the below for the properties of the fields which need to be created.
Field Label | Properties | Example | Usage |
---|---|---|---|
Allocation of Hours |
| This field would be used by users to specify the amount of hours allocated to the record. This could be added to the object Page Layout in a new section labeled “Allocations”. | |
Allocation of $ |
| This field would be used by users to specify the amount of dollars allocated to the record. This could be added to the object Page Layout in the same section as the above field to easily populate both. | |
# of Hours Tracked |
| This field will be populated by the Flow you create using the Flow Template discussed in this document. Holds the total | |
$ of Hours Tracked |
| This field will be populated by the Flow you create using the Flow Template discussed in this document. Holds the total | |
# of Hours Balance |
| This field calculates the difference between the number of hours allocated ( | |
$ of Hours Balance |
| This field calculates the difference between the number of dollars allocated ( |
Template Overview
Before we go into the steps for using the templates, let’s review it to understand exactly what they do. At a high-level, the first flow runs when the Hours (As Number)
field on a Time Tracking Summary is populated on record insert or when the field is changed. When run, the flow get’s all Time Tracking Summary records related to the Opportunity specified on the Time Tracking Summary which triggered the flow. The Time Tracking Summary records are looped through and the Hours (As Number)
and Total Hourly Rate
are totaled and stored in flow variables. The value in the variable which stores the total Hours (As Number)
is used to set the # of Hours Tracked
field, while the value in the variable which stores the total Total Hourly Rate
is used to set the $ of Hours Tracked
field, both fields on the Opportunity. In addition the Flow which runs on Time Tracking Summary insert and update, there is another Flow which runs on delete. The functionality is mostly the same, with some minor adjustments. The first difference is that the flow runs if the Opportunity lookup field is not blank and the Hours (As Number)
field is not blank. The second difference is that, when the flow retrieves the Time Tracking Summary records related to the Opportunity, it excludes the Time Tracking Summary which triggered the flow, because that is the summary which is being deleted.
Using
Thethe Templates
Now that we’ve gone through the fields and understand the templates at a high-level, let’s use them! As part of the package, the Time Tracking Opportunity Allocation, Time Tracking Opportunity Allocation Before Delete, Time Tracking Case Allocation, and Time Tracking Case Allocation Before Delete Flows will be included in a deactivated state. You could use these to start by activating them, but as a best practice, we recommend you create new flows using the templates, then add on to it for additional objects which the functionality should be applied to.
Create
Thethe Flow & Choose
Thethe Template
To start, first navigate to the Flows page via setup and click on the New Flow button. In the modal that displays, change the tab at the top to All + Templates
. In the list that displays, find the Time Tracking Opportunity Allocation template, select it, then click Create.
We start by making the flow that handles the rollup of data on Time Tracking Summary insert and update. We’ll make the flow that handles the rollup of data on Time Tracking Summary delete after.
Info |
---|
Remember that in order to track time on objects which do not already have a lookup field on Time Tracking Summary, you need to create one. |
You should now be in the Flow Builder. The first step is to change the formula used to determine the entry conditions for the flow, specifically, the piece of the formula which determines if the lookup field to the object of which you want to roll-up to is not blank. Using the screenshot below as a reference, replace NOT(ISBLANK({!$Record.TTracking__Test_Opportunity_Look_up__c}))
with NOT(ISBLANK({!$Record.<API Name of your custom field>}))
. You can use the Check Syntax button after modifying the formula to make sure it is valid.
If you would like to use a single flow on the Time Tracking Summary object to roll-up data to multiple related records as is best practice, the change would be the same for the initial object. For additional related objects, the NOT(ISBLANK({!$Record.<API Name of your custom field>}))
portion of the formula needs to include OR
logic for each additional lookup. See the below for reference.
After the formula has been modified, find the Get Opp Summaries node and click on it. This node gets the Time Tracking Summary records related to the object of which you want data to roll-up to. In this node, first change the label and name of the node so that it aligns with the object you are working with. For example, if we were trying to roll-up data to a Contact, we may change the name to Get Contact Summaries (Get_Contact_Summaries
). Then, change the value for the Field input in the Filter Time Tracking Summary Records section to the custom lookup field on the Time Tracking Summary object which looks up to the object the data should roll-up to. This will be the same field you added to the formula outlined previously. The value should be also be changed in the same way. See the below image for reference. For information on how to make this work when rolling up data to multiple objects, see the Roll-up Data for Multiple Objects section below.
After changing what was the Get Opp Summaries node, there is only one node left to change, the Update Opportunity node. Like the last node discussed, change the label and name to be something more specific to the object which will be updated. After that has been completed, start by changing the Object
input to the object which you want to roll the Time Tracking Summary data up to. This will be the same object we’ve been working with throughout this example. Next, in the Filter X Records section, where X represents the name of the object you are rolling data up to, change the Value
input such that instead of referencing the Opportunity lookup on the Time Tracking Summary, it references the lookup to the object you are rolling data up to also on the Time Tracking Summary.
You’re almost done! To complete the flow, click the Save button at to top-right of the screen. Give the flow a label, name, and description. Once completed, click Save, then click Activate to make the flow active.
Create Delete Flow
After we make the flow for handling data rollup on Time Tracking Summary insert and update, we need to make the flow which handles the same operations when a Time Tracking Summary record is deleted. The steps are very similar, so we’ll just point out the differences here. Assume the steps are the same otherwise.
The first difference is the Flow Template which will be selected when you first create the flow. Instead of choosing the Time Tracking Opportunity Allocation template, choose the Time Tracking Opportunity Allocation Before Delete template.
Similar to changing the entry criteria in the previous flow, we need to change it in this one too. Change the entry criteria formula such that instead of running when the TTracking__Test_Opportunity_Look_up__c
is not blank, the flow runs when the lookup field to the object of which you want to roll data up to is not blank. If you are rolling up to multiple objects in a single flow, then add OR
logic for each additional rollup.
The remaining changes to be made are the same as we did for the previous flow, changing the references to your new lookup from the Opportunity lookup in the appropriate nodes.
Roll-up Data for Multiple Objects
If you plan on rolling Time Tracking Summary data up to multiple objects, it is best to create one flow using the template which handles the rollup on Time Tracking Summary in insert and update, one flow using the other template which handles the rollup on Time Tracking Summary delete, then adding on to them for each additional object which needs data rolled-up. We’ve already covered the changes needed for the entry criteria to make this happen, now we’re going to see the changes needed for the rest of the flow. The changes are the same in this case for both flows.
To make the flow usable for multiple objects related to Time Tracking Summary, we need to add a Decision node, which runs the current functionality based on the lookup field which was changed or set on the Time Tracking Summary. The functionality which runs after each condition will be the same as the current functionality, so you can duplicate the nodes and complete the same steps outlined previously in this document, making the necessary lookup field reference replacements in the duplicated nodes you create for each outcome in the new decision node. Let’s look at an example where we add the functionality to roll-up Time Tracking Summary data to the Opportunity and Case objects.
The first step is to the follow the instructions outlined in the beginning of this document, creating a new Flow based on our template, then updating the Entry Criteria to be usable for both objects. Next we’ll add the Decision node to the flow. In the Toolbox section on the left-side of the page, find the Decision node in the Logic section and drag-and-drop it on to the screen.
We reference Opportunity and Case here for this example, but is if you are trying to roll up data to different objects, then substitute those in where Opportunity and Case are referenced.
In the modal that displays, give the node a label, name, and description. For the outcomes, for this example, you can relabel the first one to Opportunity. Click the plus icon next to OUTCOME ORDER
to add another outcome. For this example, label it Case. Back in the Opportunity outcome, give it a label and name. For the conditions, set the values as follows:
Resource: Opportunity lookup field on the current record
Operator: Does Not Equal
Value: (leave blank)
In Record-Triggered Flows, the Record refers to the Time Tracking Summary which triggered the flow. When we say “Opportunity lookup field on the current record”, we are referring to the Opportunity lookup field value on the Time Tracking Summary which triggered the flow.
This above criteria says that the outcome should be executed if the Time Tracking Summary which triggered the flow does not have a blank Opportunity
lookup value. Click on the Case outcome and populate the inputs with the same values, except replace the Opportunity lookup to the Case lookup.
Once you have added the outcomes for your objects, click the Done button to save the node. Back in the Flow Builder, disconnect the Get Opp Summaries node from the starting node. Connect the starting node to the new decision node we just made, then connect the decision node to the Get Opp Summaries node, using the Opportunity outcome. See the below image for example.
To add the functionality for the Case outcome, make a copy of each node in the Opportunity path, and make the changes outlined earlier in this document to make the new nodes compatible for Case. If you had more objects, you would repeat that process for each additional object. Once finished, the Case outcome path should look exactly like the Opportunity path, but with references to Case. To complete the flow, connect the decision node to the Get Case Summaries node which you create, using the Case outcome. You can now save the flow and activate it!