Object property
See also: Entity property rule
Value resolver – Abstract
Purpose: Accesses a parameter-specified field of the object that is present as an input and returns its value, if present.
The Object property value resolver accesses an object property specified by a parameter, which is present as an input value, and then returns its value.
The return value is available both for read and write accesses, as long as these are permitted for the property or data object in question.
If the optional parameter in the value resolver is not used to specify a property, the input value is passed as the return value.
►NOTE◄ This can be useful in practice to refer to the reference object as a whole (see example).
The value resolver returns 'No value' (null) if one of the following conditions is met:
There is no input value.
The object passed as an input value does not contain the addressed property.
The object passed as an input value contains the addressed property, but its value is 'No value' (null).
Configuration
The only optional value resolver parameter offers the possibility to address exactly one specific property of the data object that is present as an input value. If no property name is selected or specified, then the value resolver returns the input value. Depending on the type of input value, the dropdown menu of the respective Combobox element offers specific selection options, which usually result directly or indirectly from the data model of this type. ►NOTE◄ As can be seen in the image, the search function for an entity of the 'Company account' type (see Company accounts) returns numerous properties for the search term 'id' that relate to the company account directly (selection 'ID') or indirectly (e.g. 'address.ID'). |
|
Depending on the type of addressed property, the Object property value resolver returns a simple value (e.g. the Long value for the 'ID' of an entity) or a more complex data object, like the 'address' (address) assigned to a company account in the example on the right, which itself contains numerous properties. In the scenario on the right, the company address determined via the value resolver is used in its entirety to assign it as a value to a variable companyAddress via a Set value event action. |
|
As the example on the right illustrates, Object property value resolvers can also be 'chained' to gradually enter into more complex data structures:
►NOTE◄ The search result in the dropdown menu here also refers to the 'property' zipcode.length. The length property is automatically offered for properties with the data type 'text' (string), because a text is treated as a 'list of characters' and the number of entries in a list can always be read via the length property. |
|
The corresponding length property is not automatically offered in the dropdown for every property whose content can be a 'list'. The example on the right shows a rule for an association criteria that checks whether multiple roles have been assigned to a user account in the 'Roles' (roles) property, which requires a selection when logging in. On the left side of the Entity property rule here, two Object property value resolvers follow each other:
►NOTE◄ With knowledge of the data structure, incl. the respective property names, it is possible to enter the entire 'path' (roles.length) as free text into the Combobox element instead of concatenation:
Even if the dropdown menu does not support this compound property name, the combination produces the desired result at runtime. |
|
When there is no defined data structure for the object present as input value (in the image on the right, the context refers to the undefined 'Client object'), the dropdown usually appears empty. As the '+' symbol on the right side of the Combobox element underlines, free text can always be entered as the property name. For the 'Client object' in the example, the illustrated assignment by Set value means that this property will be created if it does not already exist. ►NOTE◄ It is not possible to create an additional property in the data of an entity in this way, although the input of free text works in a purely technical way. |
|
Example
An event handler removes certain items from the data of a business transaction object of the 'Shipment' type (see Shipments). The line item is identified by specifying the internal ID of a particular product (see Products), which is included as a feature in the line item.
The 'Product.ID' is previously assigned to a variable (removeProductId) as a value for this purpose.
Configuration:
A Direct line items value resolver is first used within an Execute with event action to set the list of all direct line tems with the 'Default' type within the item as the reference object for processing in the action block:
|
|