I have created a detail page button "Edit" in Account object. I want to show the button on account record if the account is "X". and to hide for other accounts. is it possible to hide the button on condition?

2 Answers 2


You can't hide button but you can add validation on button and perform validation based on your requirement for Onclick Javascript Custom button.



if (addYourConditionHere) {
  alert('Validation message on button')

Currently, Salesforce does not allow to show and hide the actions on a page layout based on some condition, but if you have the record types, you can create a different page layout for each record type and keep the buttons required for that record type.

This will give you the flexibility to show and hide button when you are using record type. Else, You have to go for the validation within your button or action's visualforce/Lightning component before invoking it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .