+ Start a Discussion

Validation on the Convert button



I need to introduce some simple validation on the Convert button on the Lead object.  I have two fields that each need to have a particular value (Lead Status must be Closed- Converted, and a custom picklist field Membership Level must a value chosen)


I understand that this can (should) be done using a trigger, but I'm afraid I don't know how to do that.


I work for a non-profit and we're implementing this ourselves, so would really appreciate some help please.


(My skills are confined to having attended the Admin Essentials course)


Thanks in advance



Edwin VijayEdwin Vijay



I believe you need not create a trigger for this.. All you have to do is


  • Create a Visualforce Page. Check your conditions.
  • Override the Convert button with your visualforce page.
  • Do not worry if you are new to Visualforce, you have a lot of examples and an easy guide to get you started quickly.

Let me know if you need any help.






just create a new custom button have

display type as: Button

behaviour:Execute JavaScript

OnClick JavaScript: enter your conditions and validations.


after specifying the conditions use this redirect statements:

if ( /*specify the conditions that you want to define*/)


my_URL="{!URLFOR($Action.Lead.Convert ,Lead.Id,[retURL=URLFOR( $Action.Lead.View, Lead.Id)])}";
window.parent.location.href = my_URL;
alert("Lead cannot be converted") ;
my_URL="{!URLFOR($Action.Lead.View, Lead.Id)}";
window.parent.location.href = my_URL;


this will allow you to customize the conditions for lead convertion