You need to sign in to do that
Don't have an account?
Raj R.
What error is caused by inserting empty list?
Hi, i am still relatively new to DML operations such as insert.
Let's say for whatever reason, my new list of leads is empty. What are the errors caused by inserting an empty list? Does Sf already know not to insert an empty list?
For example,
List<Lead> newLeads = new List<Lead>();
insert newLeads;
Is it recommended that I use the ".isEmpty()" method to only perform an Insert operation when the list is not empty?
if( !(newLeads.isEmpty())
insert newLeads;
Let's say for whatever reason, my new list of leads is empty. What are the errors caused by inserting an empty list? Does Sf already know not to insert an empty list?
For example,
List<Lead> newLeads = new List<Lead>();
insert newLeads;
Is it recommended that I use the ".isEmpty()" method to only perform an Insert operation when the list is not empty?
if( !(newLeads.isEmpty())
insert newLeads;
All Answers