You need to sign in to do that
Don't have an account?

find the error in code
Hi
pls find the error in the below code can anybody help me?
public class insst1
{
public void sav()
{
for(integer i=0;i<250;i++)
{
Lead c=new lead();
c.FirstName='Mr'+i;
c.company='XYZ';
insert c;
}
}
}
for Lead, LastName is mandatory...
You cannot insert more than 150 records as governor limit for DML statement is 150...
Regards,
Magulan D
Salesforce.com certified Force.com Developer.
SFDC Blog
If this post is your solution, kindly mark this as the solution.
You are doing DML (insert) inside of the loop. Instead, try something like this:
Thanku for reply.