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
Zachary SingerZachary Singer 

Leaving a required field blank causes two error messages to display

Hi everyone,,
We have VF pages with custom field labels that differ from the backend field labels. Trying to save the page with such a required field blank causes two error message to display: one using the custom label and the other the backend label. We have implemented VF pages in the same way in other orgs and do not have this issue. The VF page uses a controller which creates a map between the field API name and the label we want to show.  Because some of the custom labels are quite long, relabeling the backend fields is not an option. Any ideas are appreciated. Thanks!
Cory CowgillCory Cowgill
Can you use SObject.addError(API Field,Message)?
 
Cory CowgillCory Cowgill
Sorry I believe the correct method is SObject.get('API_FIELD').addError(errorString);