This example shows how to extend system CUBA entities, taking User entity as an example.
ExtUser entity extends and replaces User entity by adding two fields:
- address of type String
- department, which is associated to the Department entity, declared in the project
In order to reflect changes in the User Editor screen we need to create a new view, which extends the system user.edit view. In order to override the old system view, the extending view has the same name as its ancestor.
In order to show fields we extend the standard User Screen, coming with the CUBA Platform, and register it in the web-screens.xml file.
The sample aslo shows how the extended User entity can be used. In the Request Edit screen there are two fields, that should be populated by default (Request#user
and Request#department
) from the currently logged-in user.
All the steps can be completed fast and easy, using the power of the CUBA Studio, which will scaffold classes, views and screens for you.
P.S. Find another way of extending the system user entity in this sample.