You need to sign in to do that
Don't have an account?
Customize Exception message
Hi,
I wanted to display the exceptions in a user friendly way on a visualforce page.
For example: the exception message i get is something similar to the one below
" xyzAfterInsert: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id xxxxxxxxxxxxx; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, The Close Date of the Opportunity cannot be in the past. Please update it accordingly.: [] Class.xxxxx_UpdateOpportunity.updatexxxOpportunity: line 159, column 1 Trigger.xyzAfterInsert: line 29, column 1"
instead i want to display
"The Close Date of the Opportunity cannot be in the past. Please update it accordingly"
how can i do that ?
thanks,
sid
This is what happens if you use the default DML options.
Instead, use Database.Update instead of update (or Insert, upsert, etc), check if there is a failed result, and if so, just return back to the page. Salesforce should put the message back on the screen as a normal field error.
Hi sfdcfox,
I have tried something like this in the code
I don't see any change in the message displayed on the visualforce page.
Thanks,