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
JJamesJJames 

Throw error message before edit page from button

I am implementing a request to throw an error message to the user instead of going to the edit page if the object is in a certain status. My plan was to create a visualforce page and display the error if the object meets the criteria for the error message, and route to the edit page if not.

Is it possible to do this without the VF page, directly through the onclick javascript for the button click? How might I implement that? 

I just want to replace the standard edit button with a custom that would throw the error before the user gets to the edit page, instead of it throwing an error upon saving the modified data.
Neetu_BansalNeetu_Bansal
Hello James,

You can create a custom button and in onclick javascript, check the status and display error in Alert. If no error, redirect to the Edit page.

Thanks,
Neetu