I am trying to avoid to create a js button, then I have applied the following pattern to have a custom button.


My aim now is to add a validation error if it is met a criteria dont allow the user continue with the button action, I have tried <apex:pageMessage/> with ApexPages.severity.Error but I have been not able to get it.

Can you recommend me it other approach?


What it should be the best way to achieve?

  • Can you give us more background about the use case? I'm not sure what a custom button has to do with validation checks on a VF page Jun 25 '20 at 9:13
  • @BrianMiller . Basically the button should send an email from Quote object to a specific mailist. I am able to send it without problems. But I have got a new request that the email can only be sent if the account (parent object of the Quote) meet a certain criteria. In case the criteria is not meet i should display an alert or error message. Temporally I have done a JS button with alert, but my aim is to follow the patter VF + appex class + custom button. Thank you
    – l13
    Jun 26 '20 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.