While studying doing some exercises, I created an Account with 1000 Contacts related to this account.
My problem is, there the Number_field__c in the Contact Obj. What I need to do is populate the Number_field__c just to 1 to 5. When is 6, it needs to get back to 1 and so on.
I've tried many forms but I`m stuck with something like this:
Account acc = new Account(Name='Dependentes');
insert acc;
List<Contact> conList = new List<Contact>();
for(Integer i = 1; i <= 1000; i++) {
Integer n = 0;
Contact c = new Contact();
c.LastName = 'Contato ' + i;
c.AccountId = acc.Id;
c.Number_field__c = i;
conList.add(c);
}
insert conList;
As far as I could get.