Problem with extending User entity and screen

Hi,

I followed the Functionality Extension to extend the standard User entity and edit screen to add a new employee field. The employee field is related to a new Employee table that sttore employee information (name, address, etc.). I have a problem where the employee field is not saved after saving the User record. Check at database level is showing null value in the employee field of the User entity. Appreciate any advice as i’m not able to solve the problem.

Thanks in advance.

Hi,

is there any reason why the user should have a reference to the employee class? Why not switch the relationship so that the employee class has a reference to the user. The benefit is that you don’t have to mix business entities with technical entities and therefore you don’t have to extend the User class.
I’ve tried it a few times and it worked the other way around very well…

Bye,
Mario

Thanks Mario for your suggestion.

The main reason for this is I need to incorporate some data access restriction on the application data based on some rules related to employees. I am planning to use Access Group feature. The rules is a bit complication.

I will try to switch the relationship as suggested and see if it can be done. Thanks.

I agree with Mario that referencing the User from the Employee would be simpler. But your case should work too.
Try the following:

  • When defining your extended User entity (say ExtUser), do not forget to select the “Replace parent” checkbox.
  • Create a view for ExtUser with the name “user.edit”. It should extend the “user.edit” from the platform, so you will have the view with the same name as the base view. Add “employee” attribute to the new view.
  • In your editor screen, extended from user-edit.xml, the userDs datasource can still use User entity and “user.edit” view. The platform will choose your ExtUser entity and the new view at runtime automatically.