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

This exception occurs when you are trying to insert or upsert a list which is having two or more identical records. In this case we have to use set instead of list. So, that it will be overwritten because list can contain duplicates but set cannot contain duplicates.

Check this to know more about List, Set, Map.

http://www.infallibletechie.com/2012/07/list-set-and-map-in-salesforce.html

Cheers!!!

No comments:

Post a Comment