On opportunity object I have a picklist with values: 'Y' and 'X'. When opportunity has 'X' value user should be able to click button if has 'Y' when user click the button then should receive a information that value 'X' is needed to proceed.

Only value 'X' should allow click the button.

Does anybody know how in Salesforce achieve this ?

1 Answer 1


You can create Javascript button.

Below is the code snippet you can use in js button. I have considered account object as an example.

var accReq = "{!Account.Field__c}";
if(accReq != 'X') {
  alert('Only value X should allow click the button');
  • Thanks a looot!!! Jun 18, 2020 at 12:29

You must log in to answer this question.

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