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
sudhirn@merunetworks.comsudhirn@merunetworks.com 

While converting lead trigger on lead should not fire

Hi,

   I need to add a condition on trigger where it must not fire when a lead is converted into account and opportuntiy and contact Please suggest me some condition how to add this logic inside the trigger. 

Thanks
Sudhir
Derhyk Doggett -Derhyk Doggett -

Hi Sudhirn,
The following fields are available on the Lead object and should help you identify conditions when the Lead is converted:

Lead.IsConverted
Lead.ConvertedAccountId
Lead.ConvertedContactId
Lead.ConvertedOpportunityId
Hope that helps.

-derhyk
AshlekhAshlekh
Hi,

You can write a condtion in trigger it self by which you code will not execute that part which you don't want.
 
To check if a Lead has been converted and do custom lead conversion logic, the best home for such is the LeadAfter trigger, where you can check

If (trigger.isUpdate && Lead.IsConverted && !trigger.oldmap.get(lead.id).IsConverted)
//do your stuff
-Thanks
Ashlekh Gera