Replacing System Error with User Friendly Error for Constraint Violation - UD Table

I am using an ultra grid to add rows to the UD06 table. That all works great. By design I do not want key fields to be duplicated which Epicor manages fine. My issue is when a key field is duplicated, I get a system contraint exception. I would like to replace this exception with a user friendly exception. Does anyone know what event I would need to expose to capture this and what the syntax would be?


Exception caught in: System.Data

Error Detail

Message: Column ‘Company, Key1, Key2, Key3, Key4, Key5’ is constrained to be unique. Value '1001, M15819, 50, , , ’ is already present.
Program: System.Data.dll
Method: CheckConstraint


An In-Transit Data Directive might work. Check if the proposed keys are found to alread exist. Then raise an exception. This should interrupt the normal attempt to write the record, and then the system check never happens

Have you tried doing a manual data validation on the client side rather than the server side? Do a getbyid it some sort of lookup to see if it already exists, then if it does raise your own message box.