function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rob PetrieRob Petrie 

Not sure best approach to solve simple problem

Context: We have a custom object called Projects, which sinks to a system called Harvest. The projects have a child object called Time Entries, which stores start time, end time, and duration. Every night, Harvest syncs to these objects and adds new time entires. Every time entry lives on a parent Project. There are two Projects per client account, one for Client Relations, and the other for Development.

What I want: I want a roll up summary field on the Account object that sums the total Dev and CR time from the sum of time entries in the past twelve months. Unfortunately, it is my understanding that you cannot use the Today() formula on rollup summary objects.

I'm new to SFDC development but have been an admin for four years. My theoretical appraoch would be to have a trigger that runs every night on the Time Entries object and says is the date of the entry in the last 12 months, if so, check yes, if not, check no. Because the TODAY() formula will be running in the back end, I can then use that check box to create rollup summary fields and don't need to over complicate it. 

Problem: I've never written code. 

Any help here would be really really appreciated. We have a full sandbox, but no development resources currently, so I'm just trying to get started. 
William TranWilliam Tran
Rob,  triggers will definitely work.  That said, it's more technical and required writing the triggers, test classes and understand and using change sets and the deployment process.  If you don't want to use triggers I am sure there exist ways to roll up the data according to your specifications.  I may need to view the object structure and data to see how data may best be summarized.   Feel free to email me if you need more assistance.  Thx
Mahesh DMahesh D
Hi Rob,

Yes if you can explain more about the Data Model / relationship between the objects then it will be easy to provide you the solution.

Regards,
Mahesh
CloudyJoshCloudyJosh
Hello Rob,

Perhaps this can be more simply accomplished with the process builder or workflow, have you tried checking this out? Please provide more information.

Thanks!


 
Rob PetrieRob Petrie

Hi all-

Thank you all individually for your reply- I appreciate the help.

I have tried process builder, which I've used before, but haven't had any luck because I can't get it to refresh every night to keep the "rolling 12 months" functionality. 

A bit more about the data structure I am working for.

There are three objects in play here:
-Account (standard)
-Project (child object that lives on the Accounts)
- Time Entries (Child object that lives on the Projects)

Each account has two Projects, one for Dev and one for CR- these are created automatically as soon as a client signs on. 

Every night, our system adds time entries to all of the projects on a client by client basis, as entered during the pervious day. There is a snap shot of the time entries attached to this post, as well as a view of the project page.

What I want to do is build a field on the Project object that sums the "durations" with a date in the past 12 months. I want this to update every evening. Eventually I want to build a roll up summary on the account level that totals hours from both Projects used over the past twelve months.

Pictures attached- if you think it would be better to email me direclty my email is rpetrie@digitalmeasures.com. A note on the Project snapshot- this sync functionality was given to us in the form of an installed package from harvest, our time tracking tool. As such, some of the fields are not being used properly / or at all. That's the reason for all the wasted space!

Thank you all so much for your help thus far!

-Rob

Time Entries SnapshotProjects Snapshot

William TranWilliam Tran
Rob,

Since "rolling 12 months" is a moving target, it's a good likelihood that you will need to some kind of development.

Depending on what your true requirements are, there may be different ways to get the data you need, some more optimal than others.

That is, why are you trying to get this data? Is it an input for something else? How and Who is consuming the data? How often do you need to calculate it? etc.

Thx