How to enrich action upon return from the connector Servlet


Playing around with the grid, i found that not all validations could be done on the client side. Fir instance, unique keys on the database server.

How can I enrich the action returned by the Servlet to include an error message (database or custom) in the details of the action returned or as an attribut of the action ?

All I am getting from the Servlet when inserting a duplicate key is :

<?xml version='1.0' encoding='utf-8' ?>

Doesnt tell me “why”.

I tried modifying the “behavior” of my connector but “afterInsert” is never called (i assume it won’t be called since there is an DB error) but the is no “onError” behavior that would let me add information to the DataAction object.

For some custom validation you can use beforeInsert , and call something like

action.set_response_text("Some details about error"); action.error();

In case of duplicate keys - error generated automatically and there is no way to send custom message. ( except of creating a custom dataprocessor class , which is quite a lot of work )

Thanks for the response.

I am now checking the key in the beforeInsert behavior. This way, no error will be raised by the dataprocessor.

Another solution would be to add “OnError” behaviors that would allow us to add a custom message to database errors if desired. I’ve modified the original code to test this approach and it worked perfectly. This would not be the way to do it but I tried it just for fun before i decided to go the “beforeInsert” way.

If you want, I could give the code to your development team to integrate in a later release. I think it could be an interesting feature.


Yep, please send the code to the