Yest


  // Your JavaScript code here
  function greet(name) {
    console.log('Hello, ' + name + '!');
  }
  greet('World');
  

 

public static void createLeads() {

    List firstNameList = new List{

        'AARON','ABDUL','ABE','ABEL','ABRAHAM','ABRAM'

    };

    List lastNameList = new List{

        'JOHNSON','WILLIAMS','BROWN','JONES'

    };

    List companyList = new List{

        'Quantum ','BackRub ','Apple','Tokyo Tsushin Kogyo'

    };

    List statusList = new List{

        'Open - Not Contacted ','Working - Contacted'

    };

    List leadList = new List();

    for (Integer i = 0; i < 20; i++) {

        Lead newLead = new Lead();

        newLead.LastName = lastNameList.get(getRandomNumber(lastNameList.size()));

        newLead.FirstName = firstNameList.get(getRandomNumber(firstNameList.size()));

        newLead.Company = companyList.get(getRandomNumber(companyList.size()));

        newLead.Status = statusList.get(getRandomNumber(statusList.size()));

        newLead.Email = newLead.LastName + '.' + newLead.FirstName +'@gmail.com';

 

        leadList.add(newLead);

    }

    Database.insert(leadList, false);

}

 

public static Integer getRandomNumber(Integer size) {

    Double result = math.random() * size;

    return result.intValue();

}

createLeads();

Post a Comment

Previous Post Next Post