Get key of parent row

I will try to explain what I need :smile:

I have Customer and Order enties, like in the tutorial.
When I open the Customer edit mask I see all related Orders.
Now I do a right click in the Order list and select ‘create’.
The Order edit mask pops up.
Now I could select the Customer for which I want to create a new order.
But, I would like to get this preselected based on the Customer I am coming from.

Any tip would be great.



this behavior is the default behavior in a composition relationship. But it requires that the view of the order contains the minimal view of the customer attribute.

Can you share your views.xml as well as your & Then we can double check…

Here’s an example I once gave where you can see the default behavior: Is Grails the right approach for business apps? - YouTube



Hi Mario,

Very helpful video.
Will try that out.
Because I have DB models only designed by the DB team I will see,
if this fits well into the needs of the composition way…
Will inform you on Monday.



you can check out this project here (which is more or less the content of the video):

Here you can see the customer editor screen & order editor screen in action:




Setting the entity association to “composition“ does not change neccessary the way the tables are setup. It depends on how you already structured your entities.

That said, imho you’ll have a hard time letting the datamodel be defined outside of your control. When working with ORMs and especially with these full stack frameworks like CUBA is, they are making certain assumptions or have conventions that best practices but not neccessary exactly what your ‘db apartment’ would do.

The reason is that the entities and how they are layed out is the center of CUBA. A lot of stuff is built on top of that. One example is how the screen generation and default behavior of screens works.

So if you give that out of the developers control and the db model is not setup as cubas default, you will miss a lot of convinience that you would otherwise have. Im not saying it is not possile, cuba can handle different db schema settings, but it is far from optimal imho.


1 Like


I have to go the ‘hard’ way.
No chance to let Cuba create the DB model.