+ Start a Discussion

Preventing Lead conversion with a Before Trigger

Hi all,

I'm trying to find out if I can use a Trigger to prevent the conversion fo a lead (upon certain conditions that I won't detail here).

My intuition was to use a Before trigger and check the field Lead.IsConverted.
If True, I run my validation and return an error when they fail.
If False I just let the operation complete.

The problem is I'm not sure that the field IsConverted will already be set to true when I use a Before Trigger.

Is there a way to check?
Scott McClungScott McClung
Hi Gary
Why not mock up the before trigger you're thinking of and just output the value of IsConverted to the debug log so you can see whether it is what you expect?
Based on what you find, you can also use the list of records in Trigger.old or the map of records in Trigger.oldmap to view what the previous value of IsConverted was.
Hi Scott,

Thanks for your answer.
I'm currently experiencing technical issues that prevent me from using the Developer Console, which is the only way I know to experiment and debug (I'm new to Salesforce).
As soon as I can I will try, but I was wandering if this was a common question with a common solution.