SFDO-Community / declarative-lookup-rollup-summaries

Declarative Lookup Rollup Summaries (DLRS) is a community built and maintained Salesforce application that allows you to create cross object roll-ups declaratively - no code! For install instructions and documentation, visit our website https://sfdo-community-sprints.github.io/DLRS-Documentation/
https://sfdo-community-sprints.github.io/DLRS-Documentation/
BSD 3-Clause "New" or "Revised" License
695 stars 238 forks source link

Scheduled jobs failing for merged Contact records #75

Open nllpntr opened 10 years ago

nllpntr commented 10 years ago

Somewhat recently, I've noticed my scheduled rollup job fails for the majority of batches, and the logs indicate the parent record has been deleted. The relationships and queries are fairly simple, with Contact as the parent and Opportunity as the child, computing the sum of Opportunity amounts. In every instance, the parent contact records had been merged the day before the job is scheduled to run.

I'm trying to wrap my head around how the queries are pulling in Opportunities with a relationship field value that points to the old, deleted contact. Any ideas? I feel like I must be doing something wrong, but it's not immediately obvious to me.

afawcett commented 10 years ago

The scheduled job works from a kind of work list (view via the Rollup Summary Logs tab) that is built as the user manipulates the child records in realtime and records the parent record Id to update when the scheduled job is run. So i think what is happening is these log records are not aware of the subsequent merge of the contacts and thus old contact parent records are being left on the log.

The error handling in the schedule job is granular enough to not prevent log records for valid child and parent records being processed. However it will keep retrying the same log records over and over, if your confident these records represent contact parent records that have been deleted you can delete them manually.

What i can do, is mark this issue as an enhancement to perhaps provide an option or even default behaviour to ignore rollup log entries for parent records that no longer exist instead of erroring. What would be your preference?

Also, so i have a reference, can you include an example of the error please.