I have a created custom button in the Case object. The content source is Visualforce Page. When I click that button, an apex controller will be triggered. I perform some operations and update the opportunity fields in my class. I want to check a field from opportunity, if that field is empty I need to disable the custom button for that record. I'm a newbie. Not sure how to do that. I referred to some links and they do disable the command button from the onClick action. I don't have that option.

Vf page

<apex:page controller="oppClass" action="{!updateOpp}">  

How to disable the custom button. If not possible, please suggest any workaround


If you're using a Quick Action, you can use Dynamic Actions to conditionally render the button.

If you're using a normal button, you can't disable the button, but you could have your Apex code not perform the update and/or show an error in Visualforce if the feature cannot be used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.