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
Ryan Bobadilla 10Ryan Bobadilla 10 

Need to stop Contact Notification from firing in code!

Hello

I'm a bit stuck on this one.  I'm assuming now it's in this class in this part of the code and what I need to do is not to trigger the contact transfer notification even if the owner is NOT Marketo:

  // if the contact owner is marketo do not send auto email
    List <Contact> lstConvertedContacts = new List <Contact> ();
    List <Lead> lstConvertedLeads = [select Id, ConvertedContactId, ConvertedContact.Owner.Name, ConvertedAccount.OwnerId, ConvertedAccount.Owner.IsActive from Lead where Id in :insertedLeads];
    System.debug('===== About to change Owner of Converted Lead');
        System.debug('===== Currently running user name is ' + [select name from user where id=:UserInfo.getUserId()].Name);
        for (Lead nextConvertedLead : lstConvertedLeads) {
      Contact con = new Contact(
            Id = nextConvertedLead.ConvertedContactId,
            OwnerId = nextConvertedLead.ConvertedAccount.OwnerId,
            Contact_Status__c = 'New');{
        con.setOptions(dlo);
      }
      System.debug('===== Lead Id: ' + nextConvertedLead.Id + ', Contact Id: ' + con.Id + ', nextConvertedLead.ConvertedContact.Owner.Name: ' + nextConvertedLead.ConvertedContact.Owner.Name);
            System.debug('===== nextConvertedLead.ConvertedContact.Owner: ' + nextConvertedLead.ConvertedContact.Owner);
            if (nextConvertedLead.ConvertedContact.Owner.Name == 'Marketo') {
        con.setOptions(dlo);
      }
      lstConvertedContacts.add(con);
    }

    System.debug('===========>>> updating the owner on contacts: '+lstConvertedContacts.size());
    if(!lstConvertedContacts.isEmpty()) {
      update lstConvertedContacts;
    }

Anyone able to help here?  

THANK YOU!

 
Ryan Bobadilla 10Ryan Bobadilla 10
Anyone?  Still need to stop Contact Owner Transfer notification on auto-convert and ownership change from Marketo to Account Owner ownership.  HELP!