• VarunKumar
  • NEWBIE
  • 0 Points
  • Member since 2019
  • Mr
  • Self

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I am new to Apex Programming and I am trying to get through this error message. 
Below is the code that I am working on
trigger DeDupe on Lead (before insert) {
         for(Lead myLead : Trigger.new)
         {
             //Searching for matching contacts.Assigning them to the list by using bind variable. By using : with Apex Variable myLead
             List<contact> matchingContacts = [SELECT Id FROM Contact
                                              WHERE Email = :myLead.Email];
              System.debug(matchingContacts.size() + 'contact(s) found.'); 
              if(!matchingContact.isEmpty())    
              {
                  //Assign the lead to the data quslity queue
                  Group dataQualityGroup = [SELECT ID FROM Group
                                            WHERE DeveloperName ='Data_Quality'
                                            LIMIT 1];
                  myLead.OwnerID = dataQualityGroup.Id;
                 
                  //Add the dupe contact IDS into the Lead description
                  String ContactMessage = 'Duplicate Contacts Found:\n';
                  for(Contact c = matchingContacts)
                  {
                        ContactMessage += c.FirstName + ' '
                                          + c.LastName + ' '
                                          + c.Account.Name + '('       
                                          + c.Id + ;
                  }
                  myLead.Description = ContactMessage +'\n' + myLead.Description;
                }
             }
}

And I am getting following error messsage:
Error: Compile Error: Invalid identifier '        '. Apex identifiers must start with an ASCII letter (a-z or A-Z) followed by any number of ASCII letters (a-z or A-Z), digits (0 - 9), '$', '_'.