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

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.