function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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?