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
RDN_LHRRDN_LHR 

before insert on Contact not firing on Lead Conversion

Hi,
 
I've got the following trigger which simply puts the Account.OwnerId in as the Contact.OwnerId before insert.  When I convert a lead, the trigger doesn't work -- but only in Production.  When I do this in a Development instance, it does work. 
 
Why would this be?  It is the only "before insert" trigger that I have on Contact.  The only other trigger I have is a "before update" one.  I've got no triggers on Lead.  I find it very strange!!
 
Thanks!!
 

 

trigger contactInsertOwner on Contact (before insert) {

Set<Id> accSet = new Set<Id>();

     for ( Contact newContact : Trigger.new )

     {

          accSet.add(newContact.AccountId);

     }

Map<Id, Account> accMap = new Map<Id, Account>([select Id, OwnerId

                                   from Account where Id in :accSet]);

        for ( Contact updContact : Trigger.new )

         {

              updContact.OwnerId = accMap.get(updContact.AccountId).OwnerId;

          }

}

TestUtilTestUtil
There's an option to allow the firing of triggers on lead convert. It's under Setup -> Customize -> Leads -> Settings and you'll see a checkbox you need to check.

If that's not it... I'm stumped for a bit. =)
RDN_LHRRDN_LHR

I don't have this option there.  The only option I have is "Do Not Change Lead Status Values to New Owner's Record Type on Lead Conversion." 

That doesn't seem to have anything to do with triggers firing on lead conversion.

RDN_LHRRDN_LHR
I should have searched before I ever put this in ... Thanks for the advice  :smileyvery-happy:... I've put in a ticket with support to let them know that they need to unhide this option so that I can choose it.