function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aryan JhaAryan Jha 

I Have a List where two contact is being inserted and i have to update after inserting list how can i add feilds and then update it

List<Contact> conList = new List<Contact>{
    new Contact(FirstName='aryan',LastName='jha',description='computer'),
        new Contact(FirstName='atul',LastName='kumar',description='Buisness')};                                };
system.debug(+ conList );
insert conList;
List<Contact>Listtoupdate=new List<Contact>();
for(Contact con: conList){
con.Title='i am a computer analyst';
con.phone='9827373773';
system.debug(+ Listtoupdate );
}
update conList;
Nick S.Nick S.
Hi Aryan - your listToUpdate is created with no records and never gets any records added to it.  The original conList is the one that is edited.  Is that the intent?