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
Nitesh SingiNitesh Singi 

Getting the error when trying to insert records 'System.ListException: Before Insert or Upsert list must not have two identically equal elements'

Hi All,

I'm getting below error when trying the below code

Map<Id,SBQQ__QuoteLine__c> parentProducts = new Map<Id,SBQQ__QuoteLine__c>();
for(SBQQ__QuoteLine__c qli : qliToInsert){
 if( String.isBlank(qli.SBQQ__RequiredBy__r.Id) &&         !parentProducts.containsKey(qli.Id)     &&qliprodCodetoRecordMap.containsKey(qli.SBQQ__Product__c)){
parentProducts.put(qli.Id,qliprodCodetoRecordMap.get(qli.SBQQ__Product__c));
}
if(!parentProducts.values().isEmpty()){
  insert parentProducts.values(); // Getting error when inserting
}