+ Start a Discussion

Indicate which Records on a Visualforce Page has set off Validation Rule

Hi gurus,


I have a visualforce page that uses standard list controller for mass updating.  I modelled it after the example from here: http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_sosc_list_views.htm


The problem is any time the validation rule is set off it shows a general message at the top of the page but the user has no idea which record the error is applying to.  Is there a way to indicate, which record on the page set off the validation rule?




Thank you guys for your time.




While defining your validation rule, there will be 2 options as follows :


You might have chosen "Top of Page", instead choose "Field" and it will show the error message next to the field which violated the rule.


This error message can either appear at the top of the page or below a specific field on the page


Error Location:                Top of Page                               Field 



PS: Please mark this as solution and hit kudos, if it solves your problem, so that its available for others with similar issue.




Hi JK,


Yes, that is true for Standard Controllers in VisualForce Pages, but with Standard List Controllers, the error only shows on the top of the page. It does not indicate which record of the list are offending the validation rule.  :(


I'm hoping there's a way quick way but if there's a solution involving extension controllers that would be great too.




I've used the code in the link you've shared and added a validation rule on one of the custom fields on opportuntiy object and chose the validation rule's error message location as "Field".


It did work for me...I was getting the error message beside the field which violated the validation rule.