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.


images/download/attachments/128386792/image2022-2-8_17-27-47-version-1-modificationdate-1675951185179-api-v2.png

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').

images/download/attachments/128386792/image2022-2-8_17-29-33-version-1-modificationdate-1675951185176-api-v2.png

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.

images/download/attachments/128386792/image2022-2-8_17-30-11-version-1-modificationdate-1675951185172-api-v2.png

As the example on the right illustrates, Object property value resolvers can also be 'chained' to gradually enter into more complex data structures:

  • Similar to the previous example, the company account's address property is addressed first.

  • The second Object property value resolver chained below then accesses the 'Zip code' (zipcode) property within the address returned by the preceding object property.

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.

images/download/attachments/128386792/image2022-2-8_17-31-24-version-1-modificationdate-1675951185169-api-v2.png

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:

  • In the first step, the value resolver reads the roles (roles) property, which returns a list of Long values (IDs of the roles).

  • The second step reads the length property of the Long list, i.e. determines how many roles are available for the user to choose from. The result is an integer number (Integer).

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:

images/download/attachments/128386792/image2022-2-8_17-35-28-version-1-modificationdate-1675951185163-api-v2.png

Even if the dropdown menu does not support this compound property name, the combination produces the desired result at runtime.

images/download/attachments/128386792/image2022-2-8_17-33-30-version-1-modificationdate-1675951185166-api-v2.png

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.

images/download/attachments/128386792/image2022-2-8_17-37-7-version-1-modificationdate-1675951185152-api-v2.png

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:

  • The Modify list event action expects the list to be modified on the left side and the element of the list to be removed – after selecting the 'Remove' operation ([-] symbol).

  • On the left side, an Object property value resolver without a property name is used, which completely returns the list defined as a reference object. Here, the value resolver only references the outer reference object without 'resolving' a property. This same effect can be achieved with any other value resolver that returns the input value unchanged as a return value (e.g. Store value as variable or Input object (type safe) with the appropriate type selection).

  • On the right, a Rule list resolver is used to identify the line item for deletion in the list of 'Direct line items' passed as a reference object. Within the rule definition, an Entity property rule is used, which in turn uses an Object property value resolver on the left side to read the 'Product.ID'. The input value for this value explorer is the single shipment item to be checked.

images/download/attachments/128386792/image2022-2-8_17-39-14-version-1-modificationdate-1675951185147-api-v2.png