I want to Show/Hide a Button as per specific Selected picklist field value on record details page for Opportunity Object. If the picklist field value is any thing rather than that value , Button should be visible.

  • 1
    Is this on a standard Opportunity page, or are you using a Visualforce page? Also, what have you tried so far?
    – Nick C
    Oct 19, 2015 at 5:30
  • Hi Nick, This is on a standard Opportunity page having more than 10 custom buttons. I tried using Home page Components and custom javascript button, but the issue is, again i need to click on that particular JS button then it's working as aspected . which should be automated as per selection of picklist value, i mean no need to click any button.
    – Peter
    Oct 19, 2015 at 5:38
  • Can be accomplished by either replicating your page layout entirely in Visualforce and do Rendering as you wish OR ...use a workflow field update to update the record type on the Opportunity object. You could then use page layout assignments to show or hide the button. Dec 21, 2015 at 9:33
  • You can write a custom controller for Opportunity, then use <apex:actionSupport> event = "Onchange" to set the boolean value to true for the selected picklist value. Use Rendered attribute with the boolean value from the controller to show/hide the button. Oct 11, 2019 at 8:45

2 Answers 2


Not too much of a suggested reasoning, but try home page component and write javascript for on load, then check the url if it Opportunity detail page, then fire off query from JS only to get picklist value and then do the same functionality as you are doing on your custom button click.

Hope it helps



You can do this with Dynamic Actions on Lightning Pages for the Opportunity object - that is, move your custom button functionality to a quick action (perhaps a screen or auto-launched flow) and then add filters to conditionally render the quick action

You must log in to answer this question.

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