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
696 stars 238 forks source link

Open Activities still associated to the Converted Lead #164

Open BrunetChris opened 9 years ago

BrunetChris commented 9 years ago

I am using DLRS to rollup lead activities. I am now receiving an error that when the lead is converted and open activities is still associated to the lead and not the contact. Due to this the user can not complete the open activities, because its trying to update the lead record that it was converted from. Do you know what would cause this issue.

afawcett commented 9 years ago

I'm guessing because the rollup tool does not know about this parent object rule and is still trying to maintain the rolled up value when changes in the child records occur. I'm not sure what the workaround is as yet, its not a part of salesforce i'm that familar with. Can you provide some more details, steps, config and example of the error and I'll try to help. You can also try posting on the Salesforce Community Chatter Group i've linked on the README. Since i'm going to be traveling for a few days this might be a good backup plan. You can also add details here and link via a Chatter post to this issue.

BrunetChris commented 9 years ago

Andrew

Here is a copy of the error message i am receiving.

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger dlrs_TaskTrigger caused an unexpected exception, contact your administrator: dlrs_TaskTrigger: execution of AfterDelete caused by: System.DmlException: Update failed. First exception on row 0 with id 00Qi000000NdkukEAB; first error: CANNOT_UPDATE_CONVERTED_LEAD, cannot reference converted lead: []: (dlrs)".

The roll up is pretty simple. It counts how many open and completed task on a Lead object. I have attached the criterias for the rollup summary.

The user are able to convert that lead, but when they try to complete or even delete the open task that was associated to the converted lead. They get the error above. You can not even re-associate the task to the contact that was actually created during conversion.

Any help would be appreciated.

Thanks in advance

On Tue, May 5, 2015 at 6:17 AM, Andrew Fawcett notifications@github.com wrote:

I'm guessing because the rollup tool does not know about this parent object rule and is still trying to maintain the rolled up value when changes in the child records occur. I'm not sure what the workaround is as yet, its not a part of salesforce i'm that familar with. Can you provide some more details, steps, config and example of the error and I'll try to help. You can also try posting on the Salesforce Community Chatter Group i've linked on the README. Since i'm going to be traveling for a few days this might be a good backup plan. You can also add details here and link via a Chatter post to this issue.

— Reply to this email directly or view it on GitHub https://github.com/afawcett/declarative-lookup-rollup-summaries/issues/164#issuecomment-99075342 .

Chris Brunet Salesforce Engineer Fortune Technologies Inc., dba StarrForce (510) 556-1997 www.starrforce.com chris@starrforce.com

Salesforce.com Registered Partner

Facebook: facebook.com/StarrForce Twitter: @STARRFORCE https://twitter.com/STARRFORCE Blog: http://starrforce.com/cloudthink

Salesforce.com Certified Administrator Salesforce.com Certified Developer Salesforce.com Certified Sales Cloud Consultant

afawcett commented 9 years ago

Thanks for the further information, however it looks like the attachments didn't make it through? Can you try again, maybe use the GitHub UI rather than email?

BrunetChris commented 9 years ago

I have attached the files. Please let me know if this helps. dlrs criteria

jclark-dot-org commented 9 years ago

We are experiencing a similar issue for any DLRS rollup where parent object is Lead. Once the lead is converted, it is a DML error to attempt any update (c.f. https://help.salesforce.com/apex/HTViewSolution?id=000002543&language=en_US). We've tried using lead__r.isConverted=false in the relationship criteria, but I'm guessing the code still tries to update the lead based on the new (0) totals. I believe that DLRS needs to avoid attempting to update any converted lead. The platform treats converted leads as frozen in time, basically; it should be fine to leave the old rollup values.

BrunetChris commented 9 years ago

We have the same rollup criteria set up on the Contact object. If we can get DLRS to switch from the Lead to the Contact object on the conversion that would be great or not rolling up on conversion would work too. Since my roll up criteria on the Contact would basically take over from the Lead.

Chris Brunet Salesforce Engineer Fortune Technologies Inc., dba StarrForce (510) 556-1997 www.starrforce.com chris@starrforce.com

Salesforce.com Registered Partner

Facebook: facebook.com/StarrForce Twitter: @STARRFORCE https://twitter.com/STARRFORCE Blog: http://starrforce.com/cloudthink

Salesforce.com Certified Administrator Salesforce.com Certified Developer Salesforce.com Certified Sales Cloud Consultant

On Wed, May 20, 2015 at 8:00 AM, Jason Clark notifications@github.com wrote:

We are experiencing a similar issue for any DLRS rollup where parent object is Lead. Once the lead is converted, it is a DML error to attempt any update (c.f. https://help.salesforce.com/apex/HTViewSolution?id=000002543&language=en_US). We've tried using lead__r.isConverted=false in the relationship criteria, but I'm guessing the code still tries to update the lead based on the new (0) totals. I believe that DLRS needs to avoid attempting to update any converted lead. The platform treats converted leads as frozen in time, basically; it should be fine to leave the old rollup values.

— Reply to this email directly or view it on GitHub https://github.com/afawcett/declarative-lookup-rollup-summaries/issues/164#issuecomment-103918901 .

afawcett commented 9 years ago

Ok thanks both, i see the issue clearly now. This issue will be resolved when this one is fixed i feel. Though i can also imagine a fix that adds a field to the rollup definition that allows the user to define on the rollup criteria that 'excludes' master records from being updated.

BrunetChris commented 9 years ago

Andrew

Do you know what this fix will be put into place?

Chris Brunet Salesforce Engineer Fortune Technologies Inc., dba StarrForce (510) 556-1997 www.starrforce.com chris@starrforce.com

Salesforce.com Registered Partner

Facebook: facebook.com/StarrForce Twitter: @STARRFORCE https://twitter.com/STARRFORCE Blog: http://starrforce.com/cloudthink

Salesforce.com Certified Administrator Salesforce.com Certified Developer Salesforce.com Certified Sales Cloud Consultant

On Sat, May 23, 2015 at 5:36 AM, Andrew Fawcett notifications@github.com wrote:

Ok thanks both, i see the issue clearly now. This issue will be resolved when this one https://github.com/afawcett/declarative-lookup-rollup-summaries/issues/161 is fixed i feel. Though i can also imagine a fix that adds a field to the rollup definition that allows the user to define on the rollup criteria that 'excludes' master records from being updated.

— Reply to this email directly or view it on GitHub https://github.com/afawcett/declarative-lookup-rollup-summaries/issues/164#issuecomment-104888855 .

afawcett commented 9 years ago

Sorry no, i cannot make any commitments, this is an open source project, run by the community. I certainly see this as one of the higher priority enhancements to make once i do get some time. Sorry i cannot commit to a fix date for you, perhaps you want to get involved in the project yourself, your more than welcome. :+1:

afawcett commented 8 years ago

Added in v2.4.1.

afawcett commented 8 years ago

Actually this may have been fixed in an earlier release. I just retested it in v2.4.1. It maybe it was fixed by some other change, such as issue 161.

BrunetChris commented 8 years ago

Thank you very much for getting back to me.

Chris Brunet Salesforce Engineer StarrData (510) 556-1997 www.starrforce.com chris@starrforce.com

Salesforce.com Registered Partner

Facebook: facebook.com/StarrForce Twitter: @STARRFORCE https://twitter.com/STARRFORCE Blog: http://starrforce.com/cloudthink

Salesforce.com Certified Administrator Salesforce.com Certified Force.com Developer Salesforce.com Certified Sales Cloud Consultant Salesforce.com Certified Service Cloud Consultant

On Sun, Jun 19, 2016 at 2:20 AM, Andrew Fawcett notifications@github.com wrote:

Actually this may have been fixed in an earlier release. I just retested it in v2.4.1. It maybe it was fixed by some other change, such as issue 161.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/afawcett/declarative-lookup-rollup-summaries/issues/164#issuecomment-226987572, or mute the thread https://github.com/notifications/unsubscribe/ALrUEY7xYNpnZXzTVKj-NygwYuys9iLnks5qNQnhgaJpZM4EP2ER .

bwoo231 commented 8 years ago

Hi Andy, you mentioned that this issue was resolved in v2.4.1, I have v2.5 installed and have been receiving Apex Error messages for a similar situation. Here is part of the error message below.

caused by: System.DmlException: Update failed. First exception on row 7 with id 00Qd000000qfLveEAE; first error: CANNOT_UPDATE_CONVERTED_LEAD, cannot reference converted lead: []

The scenario is that I have a child object related to Leads, where I am rolling up fields from the child to the parent (Lead). When the lead is converted, DLRS is still running on the converted Lead record and causing an error.

Any help would be greatly appreciated!

AndrewKurau commented 7 years ago

If you want to avoid writing your own trigger, you could create a custom field on the Task sObject which copies relationship record Ids as string values. Then you could filter these string values. I.e., to exclude Tasks associated with Leads: ... NOT relationshipIdString LIKE '00Q%', etc. (Lead record key prefix = 00Q)