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
anam79anam79 

Exception on retrieving Custom Settings - Row with duplicate Name at index 1

Hi,

We have a managed package which uses Custom Settings and we are getting the exception "Row with duplicate Name at index 1" when the code is trying to pull back all of the settings - here is the code:
 
List<Our_Custom_Setting__c> settings = Our_Custom_Setting__c.getall().values();

We have seen there was a similar issue on sandboxes before but this is in a production org.

How would a duplicate have gotten in? Any idea how we can fix this? 
StephenKennyStephenKenny
Hi Anam,

Not sure if I am honest but perhaps during the instal of the managed package, it is creating a dupliacte custom setting? I would have thought this to be unlikly as the managed package settings are typically named quite well. In any case, you will have to remove the dupliacte otherwose you will continue to face this issue.

Please remeber to mark this thread as solved  with the answer that best helps you.

Kind Regards
Stephen
mkaufmanmkaufman
I'm also having this issue.  It's definitely a bug.  There's no easy work around, you have to do a SOQL query determine which record(s) needs to be deleted and then delete them after copying the values to the one you're going to preserve.
As a clue, I seem to be getting this when I have batch processes interacting with my custom settings.