+ Start a Discussion

Custom Button Visibility....Please help me fast..

I have a custom button in standard page layout. I have to disable this button based on one field value, scenario is if the field value changes to expected value this button  should be visible only to users of one profile and be disbled for others users? Can somebody quickly suggest , how to achieve this ?



Though its not possible to implement the functionality you desire automatically, as you find in normal web application's web pages

  • say on lost focus 
  • or whenever text changes in the text boxes of your standard page

 but you can try to implement onclick javascript on the click of another custom button which checks the value and enables or disables the other button in question as per the field value, but that is not such a clean implementation.

I would suggest ontheclick of your custom button you check:-

  • the field value and in case the value is not appropriate give the user an alert and stop further execution .
  • Otherwise if the value of the field is per your requirement let the execution continue.

Hope this answers your question...


the issue is when the custom is clicked, there is an URL mentioned which will redirect to other page to perform some function. The button is in standard page layout because of which i cannot execute javascirpt. I can include either javascript or URL(which is already mentioned) ..Now I am stuck, is there any way ?


If you are still seeking a suggestion, try something like below


<apex:commanButton disabled="{!IF(Field=='Something',false,true}"/>




Thanks, but I cannot include that becuse it is not a visualforce page, instead page layout..Any idea?


then the button that you want to disable is custom? or standard button




It is a custom button on a standard page layout of custom object..


Actually,there is no way to be disabled the standard button on standard page layout,

So, it would be better ,if you try validation rules...


Hi Balu_Dev,


Try to use two diff Record type one with Custom Button and another without Button, and use WF to update the Record Type based on the custom field.