• Wilson Busaka 3
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I am receiving this error:

"Line: 1, Column: 5
unexpected token: '<'"

when executing this code:

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

Database.SaveResult[] srList = Database.insert(conList, false);

for (Database.SaveResult sr : srList) {
    if(sr.isSuccess()) {
        System.debug('Successfully inserted contact. Contact ID: ' + sr.getID());
    } else{
        for(Database.Error err : sr.getErrors()) {
            System.debug('The following error has occurred.');
            System.debug(err.getStatusCode() + ': ' + err.getMessage());
            System.debug('Contact fields that affected this error: ' + err.getFields());
        }
    }
}

in the execute anonymous window in the developer console (this is a trailhead exercise). Thanks in advance for any help.
I want to write trigger to enable a checkbox in contact whenever its Account is modified(updated). 
I'm not able to put the condition for Account updated or not! Can you guys provide the logic?? 
 
  • April 12, 2017
  • Like
  • 1