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
ppatppat 

Lead Convert - Opportunity "before Insert" Trigger does not get fired ?

I have following simple trigger to populate one field from account.

When I convert the lead and create new opportunity , this trigger does not get fired .. However if I change something in opportunity after creation , trigger gets fired and this is due to  before update. I also tried to insert opportunity directly and trigger is working as expected

Seems like "before insert" is not working after lead conversion to opportunity

Is there any limitation of the Triggers that it does not get fired when lead is converted ? Can someone please let me know if there is a workaround ?

trigger OpportunityInsert on Opportunity (before insert,before update)
{
    for (Opportunity o : Trigger.new)
    {
        if (o.regpartner != NULL)
        {
               //dc --> Distributor Center
                Account dc = [Select Id, oc from Account where id = :o.regpartner];
             
                    o.oc = dc.oc;
}}}
TehNrdTehNrd
For triggers to fire on Opps and Accts upon lead conversion you need to enable "Enforce Validation and Triggers from Lead Convert".

This can be located under App Setup > Customize > Leads > Settings.
ppatppat
I dont see that option under Leads --> Settings :(
TehNrdTehNrd
I had the same issue. Email salesforce.com support and have them add it. It is not available by default.
ppatppat
Thanks .. !!

I will followup with salesforce.com support
Kruthika KsKruthika Ks
Thanks TehNrd.