• kondru sampreeth
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
please need your help

 line No 5 expecting a right parentheses, found ';'--- trigger
line No 12  same error in class
--------------------------------------------------------------

trigger FindDupesonLead on Lead (before insert) {
 for (Lead myLead : Trigger.new) {
    if (myLead.Email != null) {
      List<contact> dupes = [SELECT Id FROM Contact WHERE Email = :myLead.Email];

//below line getting an error
      if (dupes != null &amp;&amp; dupes.size() &gt; 0) {
        String errorMessage = 'Duplicate contact found! ';
        errorMessage += 'Record ID is ' + dupes[0].Id;
        myLead.addError(errorMessage);
      }
    }
  }
}
---------------------------------------------------------
public class FindDupesonLead {
    public static List<account> mergeDupeContactsInAnAccount(List<account> accList) {
 
        // Create a set of duplicate contacts that
        //  we will delete later. We use a set because it has the contains() method
        Set<contact> duplicates = new Set<contact>();
 
        // For each account, we will loop over every contact to find a dupe
        for (Account a : accList) {
             //below  line i am getting an error
     
            // There needs to be at least 2 contacts to have a dupe
            if (a.Contacts != null &amp;  a.Contacts.size() > 1) {
 
                // Iterate across the account's contacts to find dupes
                for (Contact outerContact : a.Contacts) {
             
                    // Skip this contact if it has been identified as a dupe
                    if (duplicates.contains(outerContact)) { continue; }
             
                    // Iterate again though the contacts to find a match by email or name
                    for (Contact innerContact : a.Contacts) {
                 
                        // Skip this contact if it has been identified as a dupe
                        if (duplicates.contains(innerContact )) { continue; }
                 
                        // Since the original contact is in this list, make sure we don't match it
                        if (outerContact.Id != innerContact.Id) {
                     
                            // Check for a match by email
                            if (outerContact.Email != null &amp;&amp; outerContact.Email.equals(innerContact.Email)) {
                                duplicates.add(innerContact);
                                continue;
                            }
                         
                            // Now check for a match by name
                            if (outerContact.FirstName != null &amp;&amp; innerContact.FirstName != null) {
                                String outerContactName = outerContact.FirstName + outerContact.LastName;
                                String innerContactName = innerContact.FirstName + innerContact.LastName;
                                if (outerContactName.equals(innerContactName)) {
                                    duplicates.add(innerContact);
                                    continue;
                                }
                            }
                         
                        }
                     
                    }
                 
                }
             
            }
         
        }
     
        // Delete dupes
       // if (duplicates.size() &gt; 0) {
           // List<contact> duplicatesList = new List<contact>();
          //  duplicatesList.addAll(duplicates);
          //  delete duplicatesList;
        }
     
        return accList;
    }

}
how we can track billing within salesforce
please let me know the document if any body having document  if it possible please send kondruxavier27@gmail.com

 
when lead status changed to"closed-but not converted" then task should be assign to a manager , 
please write a triiger how it will do?