DLRL での重複値エラー


# 解決済事例

+ [duplicate value found: dlrs__UniqueName__c duplicates value on record](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007X7oIU)

:::note
Turns out the field the rollup was built to change had been deleted. Presumably, recreating that field could solve the problem, but in my case, I just deactivated the rollup.

変更するためにロールアップが構築されたフィールドが削除されていたことがわかりました。おそらく、そのフィールドを再作成すると問題が解決する可能性がありますが、私の場合はロールアップを非アクティブ化しただけです。
:::

+ [How do I resolve DUPLICATE_VALUE error on dlrs_QualifiedParentID](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007bL2sH)


:::note alert
Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “Update Opportunity and Payment Related to Transaction” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to update records: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: dlrs_OpportunityTrigger: 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: a14Nq00000JmAEpIAN: []
:::

:::note
I think you've already figured out this is an access problem related to Guest users.

 

This has come up from time to time when a rollup is set to "Scheduled" mode. There is a trigger on the child object that, when it sees something that might cause the rollup to need to be recalculated, will create a LookupRollupSummaryScheduleItems__c record to enqueue the rollup for later processing.

These are in part uniquely tracked via the QualifiedParentID__c field. When the Guest user tries to insert a record, if another record already exists with that same ID value then the Guest user's insert fails. This is in part because the Guest user doesn't have the security permission to access that object to see the existing record.

The DLRS project needs to make some changes to smooth this out but for now that isn't being actively worked on. Hopefully soon.

In the mean time you can move the rollup to "Process Builder" mode and then schedule Full Recalculations to run on a schedule to true up the parent field. That should help avoid the error until the project team puts together a better long-term resolution.


これがゲスト ユーザーに関連するアクセス問題であることはすでにおわかりかと思います。

この問題は、ロールアップが「スケジュール」モードに設定されている場合に時々発生します。子オブジェクトにはトリガーがあり、ロールアップの再計算が必要になる可能性があるものを検出すると、LookupRollupsummaryScheduleItems__c レコードを作成して、後の処理のためにロールアップをキューに入れます。

これらは、QualifiedParentID__c フィールドを通じて部分的に一意に追跡されます。ゲスト ユーザーがレコードを挿入しようとしたときに、同じ ID 値を持つ別のレコードがすでに存在する場合、ゲスト ユーザーの挿入は失敗します。これは、ゲスト ユーザーがそのオブジェクトにアクセスして既存のレコードを表示するセキュリティ権限を持っていないことが 1 つ理由です。

DLRS プロジェクトはこれをスムーズにするためにいくつかの変更を加える必要がありますが、現時点では積極的に取り組んでいません。うまくいけばすぐに。
:::

+ [DLRS Schedule Items causing errors and screenflows to fail due to duplicates](https://trailhead.salesforce.com/ja/trailblazer-community/feed/0D54V00007eqCgnSAE)

:::note alert
This error occurred when the flow tried to create records: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: dlrs_OpportunityTrigger: 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: a1yPj000001e5AXIAY: [] (dlrs) Trigger.dlrs_OpportunityTrigger: line 7, column 1. You can look up ExceptionCode values in the SOAP API Developer Guide.
:::

+ [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. ](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000J77Jb)

:::note
以下に示す共有設定の変更に問題があることがわかりました。元に戻すとエラーは解決しました。 

すべての「ルックアップ ロールアップ ..」オブジェクトの DEFAULT EXTERNAL ACCESS 共有設定を PRIVATE から PUBLIC READ/WRITE に変更しました。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/328136/2ed25fda-0e46-4e86-9f07-2b28f51c4683.png)
:::





# 未解決事例

+ [How do I resolve DUPLICATE_VALUE error on dlrs_QualifiedParentID](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007bL2sH)

:::note alert
Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “Update Opportunity and Payment Related to Transaction” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to update records: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: dlrs_OpportunityTrigger: 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: a14Nq00000JmAEpIAN: []
:::

:::note
これが誰かの役に立つ場合に備えて、認証された Experience Cloud ユーザーに影響を及ぼしていた別の「重複した値が見つかりました: dlrs__QualifiedParentID__c...」エラーのトラブルシューティング中にこの投稿を見つけました。最終的には、ルックアップ ロールアップ サマリー スケジュール アイテム オブジェクトの内部および外部 OWD をパブリック読み取り/書き込みに変更することで、この問題を解決できました。 Public Read-Only を試してみましたが、解決しませんでした。パブリック読み取り/書き込みである必要がありました。

In case this is helpful to someone — I came across this post while troubleshooting another "duplicate value found: dlrs__QualifiedParentID__c..." error that was affecting authenticated Experience Cloud users. Ultimately I was able to resolve it by changing the  internal and external OWD on the Lookup Rollup Summary Schedule Item object to Public Read/Write. I tried Public Read-Only and that did not resolve it; it had to be Public Read/Write. 

https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007IflS0SAJ

https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000J77JbSAJ
:::



+ [Duplicate Value Error on dlrs](https://trailhead.salesforce.com/ja/trailblazer-community/feed/0D54S00000LIKq3SAH)

:::note alert
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: a268X00000CKTOW: []

Trigger.dlrs_npe03_Recurring_DonationTrigger: line 7, column 1
:::

私も以下のように思ったけど、無いって回答してますね。

usually this error appears if you are populating a field such as an external id that should have a unique value. I would check your field you're trying to populate with DLRS and make sure that the unique value is not checked in the Object Manager. 

通常、このエラーは、一意の値を持つ必要がある外部 ID などのフィールドを入力している場合に表示されます。 DLRS を使用して入力しようとしているフィールドを確認し、オブジェクト マネージャーで一意の値がチェックされていないことを確認します。


以下も似たような質問、 line 7, column 1と同じところでエラーになってます。

+ [Hi Team, I received the below Developer exception from DLRS Package Code.](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007CtsMZ)

:::note alert
caused by: System.DmlException: Upsert failed. First exception on row 0; first error: DUPLICATE_VALUE, doppelten Wert gefunden: dlrs__QualifiedParentID__c ist ein Duplikat des Werts im Datensatz mit folgender ID: a3n5J000000ypld: []

Trigger.dlrs_SVMXC_Service_Order_LineTrigger: line 7, column 1
:::

以下のように解答したけど、違うらしい

 I had the same issue with the Community users and I was able to resolve this by changing the 'Calculation Sharing Mode' to 'System' (from the default user). 


https://github.com/SFDO-Community/declarative-lookup-rollup-summaries/issues/838


'Calculation Sharing Mode' is set to 'System' only in our Configuration and still facing the issues.

Please let us know if any further changes are required.

外部Idが怪しいと思うけど...

+ [Unable to create work order with guest user](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007F2yufSAB)

:::note alert
dlrs_WorkOrderTrigger: execution of AfterInsert\n\ncaused by: System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__UniqueName__c duplicates value on record with id: a079r00000DM7RyAAL: []

\n\n(dlrs)\nTrigger.dlrs_WorkOrderTrigger: line 7, column 1
:::

+ [Unable to create work order & task record with guest user](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007NC1wcSAD)

必ずline 7, column 1

:::note alert
Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, dlrs_WorkOrderTrigger: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__UniqueName__c duplicates value on record with id: a079j00000O96GrAAJ: [] (dlrs) Trigger.dlrs_WorkOrderTrigger: line 7, column 1: []

Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, dlrs_TaskTrigger: execution of AfterInsert

caused by: System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__UniqueName__c duplicates value on record with id: a079j00000O6GiPAAV: [](dlrs) Trigger.dlrs_TaskTrigger: line 7, column 1: []
:::

親はCaseかぁ。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/328136/ee0d3b89-fd10-80f4-0f69-2314bb20f4f0.png)


# Unable to create work order & task record with guest user

+ [Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, dlrs_WorkOrderTrigger: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: dlrs__UniqueName__c duplicates value on record with id: a079j00000O96GrAAJ: [] (dlrs) Trigger.dlrs_WorkOrderTrigger: line 7, column 1: []](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007NC1wc)

# 使われていないフィールドが問題か？

+ [DLRS error when trying to merge accounts](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007PvdH7)

:::note alert
dlrs_AccountTrigger: execution of AfterDelete caused by: dlrs.RollupService.RollupValidationException: Scheduled rollups are running in legacy mode and are unable to resolve corresponding shadow rollups. Please visit the Lookup Rollup Summary Tools tab for more information and steps to resolve. (dlrs) Trigger.dlrs_AccountTrigger: line 7, column 1
:::

:::note
Here is the new page for guidance on deleting the now unused field

https://sfdo-community-sprints.github.io/DLRS-Documentation/Issues/#attention-need-to-delete-unused-field-on-dlrs__lookuprollupsummaryscheduleitems__c

https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A6ijQSAR
:::

これも同じことをしたかった？
+ [I'm trying to uninstall dlrs package and cannot. There are no dlrs records and I tried to delete the class using workbench and that did not work either. Please help](https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000JdLu8)

+ [duplicate value found: dlrs__UniqueName__c duplicates value on record](https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007X7oIUSAZ)