Thursday, 28 August 2014

how to customize error messages in the BC4J

That exercise requires you to prepare sample fusion application that bases on departments table in HR schema. There will be only one page that displays updateable grid of data from the ViewObject with additional Commit and Rollback buttons (always enabled).

For test purposes assumption is that each department has assigned a manager to it (ManagerId is not empty). Please go to the Department entity, select Business Rules tab. Click on the Entity Validators node and green plus icon in the top right corner.

The rule disallows null values in the ManagerId attribute. Sample is ready to run. Remove values from two or more rows in the table and click Commit button.

Entity validators are fired properly. But here you can see all of the attributes, it is really easy to point the row that causes an error. The real life is not so simple. For the user it'll be a lot easier with the human readable message that contain hints how to fix the problem.

Please go back to the error message definition and change them as on the screens below. Note that Expression field executes Groove scripts.

Re-run the test and the user know exactly what went wrong.

Few clicks to achieve very nice effect. While writing this post i've found hundreds of usages :)

No comments:

Post a Comment