+ Start a Discussion
Lee.ax1423Lee.ax1423 

System.ListException: Before Insert or Upsert list must not have two identically equal elements

Hi, I am doing bulk insert in custom object from visualforce page using controllers.. In that custom object I have two fields called startdate__c ,enddate__c. I fired some validation rule on that i.e enddate__c < startdate__c. while I am entering data from visualforce page if I enter endate less than start date its showing error in visualforce page.. and after I correct and click save button it is showing System.ListException: Before Insert or Upsert list must not have two identically equal elements error. I am not aware of that.. can any one knows about this.. Here is my Controller :- public class ProjectMileStonesCon { /* public List wrappers {get; set;} public static Integer toDelIdent {get; set;} public static Integer addCount {get; set;} private Integer nextIdent=1; public Customobj1__c cusob; public List mls = new List(); public ProjectMileStonesCon(ApexPages.StandardController controller) { wrappers=new List(); cusob = (Customobj1__c)controller.getRecord(); for (Integer idx=1; idx<=1; idx++) { wrappers.add(new PTeamWrapper(nextIdent++,cusob)); } } public void delWrapper() { Integer toDelPos=-1; for (Integer idx=0; idx
Best Answer chosen by Admin (Salesforce Developers) 
Gunners_23Gunners_23

Usually this happens when you're trying to put the same records into lists. Code inside the post is difficult to interpret, but i

 

guess you're adding records to the list in controller or method and click of it again in another method you're trying add the same

 

record to the list.

 

 

All Answers

Gunners_23Gunners_23

Usually this happens when you're trying to put the same records into lists. Code inside the post is difficult to interpret, but i

 

guess you're adding records to the list in controller or method and click of it again in another method you're trying add the same

 

record to the list.

 

 

This was selected as the best answer
Lee.ax1423Lee.ax1423
Thanks for your reply.. I solved that case... it's working fine...