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?
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.