Will the following snippet work ? – Salesforce Interview Question

Will the following snippet work ? – Salesforce Interview Question

Sample Code:


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;
        }

    }
}

Answer:

No.

The reasons are
Total number of DML statements issued – 150
LastName is a mandatory field.

Leave a Reply