Skip to main content
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!

 
1 answer
  1. Apr 13, 2016, 9:09 PM
    Anyone?  Still need to stop Contact Owner Transfer notification on auto-convert and ownership change from Marketo to Account Owner ownership.  HELP!
0/9000