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
MaxaMaxa 

Validation rule for custom button

Hi,
Here is my issue
i have a custom button that converts lead, however if specific lead field  is populated i woudl like to be able to disable this button. is it possible? or at least i like to error show up says operation not possible, and prevent from executing the script that is assigned to the button.
 
 
 
Max A
shillyershillyer
Hi Max,
 
You can't programmatically remove a button on a standard page layout, but if you build a Visualforce page you could build logic like that.
 
Another option, use the AJAX Toolkit behind your button and have a conditional statement that queries your lead field and either displays an alert or executes your convert. You can find convertLead examples in the docs.
 
Hope that helps,
Sati