Add parent entityId parameter to ChildEntityOptionField

Description of the limitation and why it is relevant to address

As an application developer i would like to use the ChildEntityOptionField and ChildEntityMultiSelectField for childs of other entities, so not only from the current entity.

I think this is relevant for the VIKTOR platform because this removes the need to use the Viktor API() to generate the options myself in a normal OptionField.

Submitter proposed design (optional)

Add a ‘parent_entity_id’ to the parameters of these fields.
In general, I think api functions/fields should return entity objects (possibly without params) instead of entity ids.

Current workarounds

Use the API() myself to get the entities and put them in a normal OptionField.

Excellent suggestion Maarten. We are currently working a generic version of the ChildEntityOptionField which enables a similar field but for a different part of the entity tree. This will result in less code and better performance in the editor.

1 Like

Added in v13.0.0: SDK Reference - Parametrization | VIKTOR Documentation

1 Like