Is new entity
The behaviour type Is new entity examines the element data of the executing element to determine whether it refers to a 'new' – i.e. previously unsaved – instance of an entity. The entity in question can be a business object (see Shipments, Orders, Manifests, Common business object), a line item of a business object, a configuration object or a master data object.
Within a form, several entities of different types are often in a hierarchical relationship. A business object can contain line items and often uses typed attributes to refer to addresses or company accounts, which in turn use addresses. Starting from the executing element, the behaviour type Is new entity always refers to the nearest parent entity.
For Input forms, there is at least a reference to the entity that provides the form data. Portals and Dashboard, on the other hand, are by definition not bound to any entity, but can contain data from entities, for example, if an entry form is embedded (see Embed forms (Sub-forms)) or when data from an entity has been set for an Element containers using Populate element data.
Only if the executing element fulfills all of the following conditions are the Actions on 'false' executed, since a data object that is 'not new' was detected:
The element data are directly or indirectly related to an entity.
The identified entity has a long value other than 0 in the ID (id) field.
►NOTE◄ Whether the entity actually exists on the server side is not the subject of the check. Only the form data available at the client is evaluated.
Conversely, the Actions on 'true' are executed if one of these conditions is not met, i.e. either no reference to an entity exists (e.g. in a portal) or an entity has been detected to which no ID (id) has yet been assigned (default value 0).
The behaviour type does not expect any input data ($input) and passes this data directly to the respective actions if necessary.
Examples
Within the same entry form for Shipments, the behaviour type Is new entity should be used to demonstrate two different entities:
At header level ('Shipment'), it should be ensured that the required header data (required fields) have been filled in and saved before line item data can be edited.
When editing line items, any line items added since the shipment was last saved should be marked with a suitable symbol (
).
Runtime examples:
When creating a new shipment, only an inactive 'placeholder' appears for the line items.
Once the header data has been filled in, access to line items (see below) can be obtained by 'saving' and the note in the label disappears:
If the shipment is saved after entering the first line item, the symbol (
) for the first row disappears and the newly added item can be distinguished:
Configuration:
|
A behaviour is configured for the form element, as shown on the left:
|
|
The behaviour shown on the left has been configured for the text field 'Line item no.' (see above) in the Repeatable element container for the 'Line items'. Therefore, the respective shipment line item is the essential entity for the behaviour type:
►NOTE◄ It is not possible to see whether a previously saved position has been changed. |