i have set up a few validation rules and i have a VFpage using this object. I am able to capture the validation exception and display it on the VF page. The issue is that it shows message as
" Upsert Failed : First exception on row 0: first error;
FIELD_CUSTOM_VALIDATION_EXCEPTION Quantity cannot be empty
Is there a way i can just capture the error message in validation Rule "Quantity cannot be empty" ?
Thanks
Visualforce can do this for you
<apex:pageMessages/>
tag to your page. (This is the container that displays any error messages if present)try {} catch(DMLException e) {}
(When you catch the exception you won't get redirected to the error pages, but salesforce will automatically create a "PageMessage" for the validation failure.