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
sachin kadamsachin kadam 

salesforce intentionally insert duplicate records through apex.

HI 
i am writing a trigger to create records in a custome object on a event. 
when insering i am getting error message : System.ListException: Before Insert or Upsert list must not have two identically equal elements

issue is these records can be duplicate i still need to insert them is there any way to insert duplicate records which are in the list?.
sridharbsridharb
Hi Sachin,

Wonderinng are you trying to insert same record on which you have trigger...In that case it would go into Infinite loop.  Could you be more clear on your question precisely with the Objects.

Regards
Sri
sachin kadamsachin kadam
Hi 

i have a batch that runs every night and picks data for certain fields from a custom object and inserts in to different object as i dont have a external if or any unique fields there can be duplicate in the list which is totally normal I want to insert them any way