Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlrs_RegistrationTrigger: execution of AfterInsert caused by: System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__QualifiedParentID__c duplicates value #964

Closed
joespec opened this issue Jul 23, 2020 · 20 comments
Labels

Comments

@joespec
Copy link

joespec commented Jul 23, 2020

I get the following error when a site guest user tries to create a regeistration:

dlrs_RegistrationTrigger: execution of AfterInsert caused by: System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__QualifiedParentID__c duplicates value on record with id: a0p4N0000086VlM: [] Class.dlrs.RollupService.updateMasterRollupsTrigger: line 1088, column 1 Class.dlrs.RollupService.handleRollups: line 1001, column 1 Class.dlrs.RollupService.triggerHandler: line 329, column 1 Trigger.dlrs_RegistrationTrigger: line 7, column 1

I've updated to the latest version 2.12. and removed the log records and field as instructed.
There is a scheduled rollup on registrations, when active this error occurs, when inactive it does not.
I tried granting read access on all dlrs objects as a similar issue suggested but that didn't help.
I also tried cloning the rollup. I believe when I did this the first time I tried to add a registration via the site it worked, but the next time it had the error again. (99% sure that's what happened)

Also actual recalculating the rollup doesn't seem to cause an error.

Thanks for any help

@joespec joespec added the bug label Jul 23, 2020
@afawcett
Copy link
Collaborator

Ah man this sucks i thought i had got rid of this error once and for all. :-(

Can you provide some furthe details on a simple rollup config and repo steps?

@joespec
Copy link
Author

joespec commented Jul 27, 2020

Hi Andy,
Thanks for the response.
I'm attaching a screenshot of the rollup config.
To reproduce the error , when this scheduled rollup is active, if an external user goes to the registration page sitting in a site, and attempts to register for a course they receive this error. The registration process creates a registration record, and will updated the contact record as well.
Here's the full criteria since you can't see it in the jpg.

Iteration_Start_Date__c>=2013-01-01 AND Iteration_End_Date__c <=TODAY AND Iteration_Record_Type__c='Open_Enrollment' AND (Status__c='Registered' OR Status__c = 'Paid' OR Status__c = 'Transferred In' OR Status__c = 'Group' OR Status__c = 'Replaced In')

Thanks for your help

2020-07-26_16-39-15

@joespec
Copy link
Author

joespec commented Jul 27, 2020

Hi Andrew.
Some more info. I've also been sent this error via email a few times in the last day: This is a bit strange as I don't have a contact as a child in any relationship, so I dont know why there would be a child trigger on that object. (also fyi I deleted and rebuilt the child trigger for the rollup in question, but it didn't help)

Apex script unhandled trigger exception by user/organization: 00561000001jKEx/00D61000000cvju

dlrs_ContactTrigger: execution of AfterUpdate

caused by: dlrs.fflib_QueryFactory.InvalidFieldException: Invalid field 'CreatedDate' for object 'dlrs__LookupRollupSummary__c'

Class.dlrs.fflib_QueryFactory.getFieldPath: line 91, column 1
Class.dlrs.fflib_QueryFactory.addOrdering: line 543, column 1
Class.dlrs.fflib_SObjectSelector.configureQueryFactory: line 434, column 1
Class.dlrs.fflib_SObjectSelector.newQueryFactory: line 318, column 1
Class.dlrs.fflib_SObjectSelector.newQueryFactory: line 300, column 1
Class.dlrs.RollupSummariesSelector.CustomObjectSelector: line 165, column 1
Class.dlrs.RollupSummariesSelector: line 80, column 1
Class.dlrs.RollupService: line 1135, column 1
Class.dlrs.RollupService: line 816, column 1
Class.dlrs.RollupService.triggerHandler: line 329, column 1
Trigger.dlrs_ContactTrigger: line 7, column 1

@joespec
Copy link
Author

joespec commented Aug 17, 2020

I wanted to follow up in case anyone else was experiencing similar issues.
To resolve this I ended up uninstalling DLRS completely (did not save data, deleted uninstalled image after uninstall)
then reinstalling it. I then recreated the specific rollups I had in there previously and the issues were resolved. (luckily I only had 3 rollups)

My uninstall process wasn't straight forward, it wouldn't uninstall saying I had various triggers still in place. I had already removed all trigger code, but when deleted all the specific rollups that go it further along.
So after all my rollups were deleted there were still 2 phantom triggers out there preventing uninstall.
To delete these I ended up creating a tempory rollup for the same objects, creating the child triggers for these objects as you usually would for a real-time rollup, then removing them. This got rid of them and I was able to uninstall.

@joespec joespec closed this as completed Aug 17, 2020
@joespec joespec reopened this Aug 18, 2020
@joespec
Copy link
Author

joespec commented Aug 18, 2020

Unfortunately, It looks like the original error has come back.
I've noticed that the error will occur when I have both my real-time rollup and scheduled rollups with registration__c as the child object. If I disable either of them the error will not occur also if they are both set to real-time it will not occur.

@sidwiesner
Copy link

I'm seeing a very similar error when I switched on the new Sharing Settings restriction for guest users. Note that if I shift all rollup jobs to real-time (most are scheduled right now), things work for the guest user. Or if I disable all of them, things work. Or if I disable that guest access security flag, things also work.

15:34:32:701 EXCEPTION_THROWN [93]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, dlrs_SMSTrigger: execution of AfterInsert
...
15:34:32:000 EXCEPTION_THROWN caused by: System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__QualifiedParentID__c duplicates value on record with id: a2D1x0000001qNp: []

@ritturoy
Copy link

ritturoy commented Jan 8, 2021

Any solution for this? We are seeing this issue for Site guest user.

@cesera
Copy link

cesera commented Feb 4, 2021

Is there an solution for this? I am getting the same error:

dlrs dlrs_In_Form_TenancyTrigger: execution of AfterUpdate caused by: System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__QualifiedParentID__c duplicates value on record with id: a2F4H000001CH6V: [] (dlrs) Trigger.dlrs_In_Form_TenancyTrigger: line 7, column 1

@cesera
Copy link

cesera commented Feb 4, 2021

I just found from another issue (#956), that if I give all profiles read access to the following four DLRS objects the error disappears:

  • Lookup Rollup Calculate Jobs
  • Lookup Rollup Summaries
  • Lookup Rollup Summary Logs
  • Lookup Rollup Summary Schedule Items

Hope this helps someone.

@wilsonpho
Copy link

Hi there,

Has there been a definitive solution to this error? It happens whenever a Community Cloud guest user tries to donate to our organization. I have multiple DLRS rollup fields that counts and sums up donation records, which is around 4,000. The rollups are scheduled for a nightly calculation.

I gave read access to Guest User for all DLRS objects and upgraded to the latest release already.

Thanks in advance for any help!

Wil

dlrs error

rollup example

@curiousjbird
Copy link

Checking to see if there has been any solution to this issue. I'm experiencing it as well with community users (logged in). I've given them read permission of the DSLR objects. I've updated to the latest package. Still getting the issue. Disabling one of my rollups fixes the issue. I'm about to delete it and recreate it to see if that does anything.

@wilsonpho
Copy link

When I changed the Calculation Mode to either System or Process Builder, it worked. I would suggest you join the Salesforce DLRS community group, as there are many folks there who have a deeper understanding of this app. That's how I was able to find this solution.

Wil

@skfh82
Copy link

skfh82 commented Aug 29, 2021

In the DLRS code:

LookupRollupService is declared as "with sharing". It might help if it was declared as "without sharing".

@streetyouth
Copy link

I am getting this type of error today on version .15 when someone attempts to create a signup from the public site of V4SF. Attempting to remedy with the permissions mentioned above given to the guest user.

@streetyouth
Copy link

Error above is: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, dlrs_GW_Volunteers_Volunteer_Ha0OTrigger: execution of AfterInsert caused by: System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__QualifiedParentID__c duplicates value on record with id: a2q5A0000032wdT: [] (dlrs) Trigger.dlrs_GW_Volunteers_Volunteer_Ha0OTrigger: line 7, column 1: []

@streetyouth
Copy link

I believe I gave the guest site user the above mentioned permissions but got the same result. This is blocking our volunteer signups. Now sure how to proceed? Is is a specific rollup? I'm not sure how to get more info to track it down.

@streetyouth
Copy link

No joy... stuck.

@brade-odusa
Copy link

I'm stuck on the following error:

Error Occurred: This error occurred when the flow tried to create records: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: dlrs_TaskTrigger: execution of AfterInsert caused by: System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__QualifiedParentID__c duplicates value on record with id: a1k5a000009Iy1n: [] (dlrs) Trigger.dlrs_TaskTrigger: line 7, column 1.

The flow that's creating the Task is triggered by a Guest User. Any ideas how we can fix this?

@awohlforth
Copy link

I was able to avoid the error by moving the DLRS into realtime as suggested above, thank you!!

@aheber
Copy link
Contributor

aheber commented May 26, 2024

Duplicate of #375

@aheber aheber marked this as a duplicate of #375 May 26, 2024
@aheber aheber closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests