+ Start a Discussion
sai manojsai manoj 

Developer Beginner ==> Apex Basics & Database ==> Manipulate Records with DML

I getting Error while doing example which is given by trailhead 
User-added image
while executing this code in anonymous window
// Create a list of contacts
List<Contact> conList = new List<Contact> {
    new Contact(FirstName='Joe',LastName='Smith',Department='Finance'),
        new Contact(FirstName='Kathy',LastName='Smith',Department='Technology'),
        new Contact(FirstName='Caroline',LastName='Roth',Department='Finance'),
        new Contact(FirstName='Kim',LastName='Shain',Department='Education')};
            
// Bulk insert all contacts with one DML call
insert conList;
// List to hold the new contacts to update
List<Contact> listToUpdate = new List<Contact>();
// Iterate through the list and add a title only
//   if the department is Finance
for(Contact con : conList) {
    if (con.Department == 'Finance') {
        con.Title = 'Financial analyst';
        // Add updated contact sObject to the list.
        listToUpdate.add(con);
    }
}
// Bulk update all contacts with one DML call
update listToUpdate;
please giude anyone 
 
mukesh guptamukesh gupta
Hi Manoj,

As per error, Please check workflows and process builder that's update to "Contact" object and deactivate this.


if you need any assistanse, Please let me know!!


Kindly mark my solution as the best answer if it helps you.

Thanks
Mukwsh


 
Miles Smith 5Miles Smith 5
for me, this thread solution worked  https://salesforce.stackexchange.com/questions/164931/is-there-a-way-to-call-javascript-after-action-on-visualforce-page​ (http:// https://salesforce.stackexchange.com/questions/164931/is-there-a-way-to-call-javascript-after-action-on-visualforce-page​)
with regards
https://get3dsemulator.org/  (https://get3dsemulator.org/https://get-cartoonhd.org/ https://playboxs.me/