I've a VF page which creates cases. It has lot of validation rules, workflows and approvals associated with it. When a user enters details to edit a vf page which is in approval process (user is not the assigned approver), upon save, I get the message "Save success" along with "Record locked". How do I avoid showing Save success message when there's an error or when a validation rule fires. I want to just display the error message. Please look at the below image firing a validation rule but it also shows Save success.

[![enter image description here][1]][1]

1 Answer 1


You can loop over the messages in the ApexPages.getMessages() collection in your controller and whenever you find one or more messages with a severity of ApexPages.Severity.ERROR don't add your success message.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .