Duplicate Primary Key error while creating new Entity record like create FixedAsset

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Duplicate Primary Key error while creating new Entity record like create FixedAsset

Anil Patel
Hi,
We have forms that handle create/update entity data. One of the common
problems user run into is, In the Create New Form (e.g New FixedAsset) user
enters value in Id field. There is possibility that the value entered may
already exist in database. In such situations, Form returns with error
message, But also Opens existing entity in Edit/Update mode in the form.
This confuses user.

Most of these create/update form directly post to CRUD services. Is it OK if
I added a Simple Method event handler that took the request call and
forwarded to CRUD service and then on return of service check if there is
error, In case of error set the value of primary key field to nothing so the
create/update form will not be able to read existing entity to open it in
Edit mode.

If this is Ok to do, Should I add Event handler simple methods in existing
services xml files (e.g FixedAssetServices.xml) Or should I create a new
file that will have such event handler simple methods.

If I can get Feedback on this email it will be easy to prepare a patch to
fix http://issues.apache.org/jira/browse/OFBIZ-547.

Regards
Anil Patel