+ Start a Discussion
Skip KSkip K 

Custom Object button throws error

I created a button on the Contact object that calls a method on an apex class. It creates a custom object and forwards the user to a VF page and returns the custom object. Upon insert there is an exception thrown due to a validation rule failure. The exception is caught in a try/catch block. I want to show an error message on the Contact page displaying why the insert failed. Can someone share how to do this?