Scenario: I have a custom button on a standard layout, which will call an apex class to do some validation on a record. If not validated, it needs to throw out some errors on that page. What are the best UX options to achieve this?
I am not too sure how to achieve this. Within a trigger, you can use the addError method to add the custom errors.
Can my Apex class reference the fields of a standard object? The ideal approach would be to do the following:
Contact.Email.addError('Please enter the right format here');
How can I achieve this via an apex class that the custom button will call?
What I have thought: Having a VF Page popup on the screen so that user can see all the errors, but that's not the best approach as UX is a big deal for this application