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
Rakesh Kumar 335Rakesh Kumar 335 

Can Validation rule fire when convert button or javascript button is pressed on lead?

There are two buttons on lead. 1.Convert, 2. Do not send
Clicking on convert opens a visual force page, while do not send is a java script button.
The requirement is, when either of these buttons are pressed a validation need to fire if the picklist value is selected as "unknown" for the field "cx interested?" on lead.  This field has 3 picklist values: Yes/No/unknown. The validation should fire only when the value is selected as "Unknow"
Now pls tell me what changes i need to make in visual force page and java script button.
Raj VakatiRaj Vakati
Yes Rakesh, Please check "Require Validation for Converted Leads" on lead settings.
harika jharika j
Hi Rakesh,
Create a custom button on lead object by using the following js code snippet


if(cx_interested__c == "unknown"){
alert("*****cx_interested__c = "unknown"*****");'/apex/TestPage');

Mustafa JhabuawalaMustafa Jhabuawala
Hi Rakesh,

If clicking those buttons results into updating or inserting the record then the validation rule will be fired for sure.

In your case if clicking on button is opening a visual force page or a javascript is executed without inserting or updating the record then validation rule is not going to be fired.

If this is the case with you then you have to do the validation rule logic in your visual force page itself or in your javascript.

Hope you got my point.

Mustafa Jhabuawala
Technical Lead at Zen4orce (
Amol Salve 14Amol Salve 14
Hi Raksh,

Validation rule can fire if if the picklist value is selected as "unknown" for the field "cx interested?"  on click of "Do not send" button because this is javascript function you can write logic whille creating this button as 


if(cx_interested__c == "unknown"){
alert("*****cx_interested__c = "unknown"*****");'/apex/TestPage');


But you can't fire validation rule on convert button as it open Visualforce page..

Thank you
Amol Salve
Salesforce Developer