You need to sign in to do that
Don't have an account?
Harsha Shri
DML exception on VF Page
Hi All,
I have a button on visualforce page to save records into custom object. I have created a uniqie text field and workflow to prevent duplicate values.
but, when I am clicking on save button from VF page it is throwing following error.
I know this error is showing because of unique values are found while creating record.
I do not want to show this error, I want to show some standard message like already record is there. How can I handle this using apex?
please help me
Thanks in Advance
I have a button on visualforce page to save records into custom object. I have created a uniqie text field and workflow to prevent duplicate values.
but, when I am clicking on save button from VF page it is throwing following error.
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>: []
I know this error is showing because of unique values are found while creating record.
I do not want to show this error, I want to show some standard message like already record is there. How can I handle this using apex?
please help me
Thanks in Advance
public PageReference save() {
try {
update account;
} catch(DmlException ex){
ApexPages.addMessages(ex);
}
return null;
}
All Answers
public PageReference save() {
try {
update account;
} catch(DmlException ex){
ApexPages.addMessages(ex);
}
return null;
}