Creating new instances of relatedEntity after opening screen via relatedEntities component

Hi

I am opening a related Entity’s screen via the relatedEntities component.
The screen for the related Entity has been created using ‘create standard screen’ with “create single screen” for browse and edit selected.

When I create a new instance of the related Entity, it is not automatically associated to the parent Entity instance selected when clicking the relatedEntities component.

Is this the normal behaviour?

Hi Matthias,

i think it is. The related entity only sets a filter for the parent entity. the behavior that you describe can be achieved when having a Composition (like from Order --> LineItems). Within the normal edit screen of the order, you will be able to see only the lineItems of the order, and when you add a new line item - the order will be set for the line item.

It is an interesting question to think about for a possible extension of the related entity feature.
Basically it would mean, that when a certain related entity screen is opened, you basically set the context to only act on a particular subpart of the data:

  1. see only the items (lineItems) that are related to the original one (order)
  2. When doing the normal CRUD stuff, it will use the context as well for setting the order
  3. It could potentially be a little more prominent in the UI in which context the user acts (like the selected order etc), because right now it’s not even displayed in the generic filter component (at least not very prominently)

Perhaps the CUBA folks have some opinions on these ideas?

Bye,
Mario

Hi Mario, thanks for your reply.
The behaviour I described is actually happening for a Composition (opened via the relatedEntities button).

Matthis

Hi guys,

I think the idea of creating a context for further operations with selected related entities makes perfect sense. Not sure it can be easily implemented though, so I’ve just filed an issue for now.

Thank you!

I think a very good first step would be that instead of just using the generic filter in a hidden way, it could be that the context instance is used as a normal filter (with either a LookupField, or in case of multiple instances, a list of entries).

Hi Matthias,

i wasn’t aware of that. This is interesting. Will give it a try…

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-8233