Set values

Siehe auch: Set value, Create instance with values

Event action – Abstract

Purpose: The Set values event action combines a flexible number of assignments in a single event action, for the configuration of which one source host and one target host can be defined as input values.

images/download/attachments/189441276/image-2024-12-9_9-21-30-version-1-modificationdate-1733732489624-api-v2.png

The Set values event action combines a flexible number of assignments (Source values → Target values) in a single event action.

For the context of these assignments, a Source host and a Target host can optionally be defined via a value configuration.

  • If there is a value configuration for the Source host, its return value is used as the input value for all value configurations for Source values in assignments.

  • If there is a value configuration for the Target host, its return value is used as the input value for all value configurations for Target values in assignments.

  • Without a value configuration for the Source host or the Target host, the reference object in the execution context (if available) represents the input value for value configurations on the relevant page in all assignments.

The individual value configurations in the assignments are not necessarily bound to the Source host or Target host. Any other data objects or static values of any kind can be addressed via value resolvers.


IMPORTANT◄ The entity and entityClass variables do not refer to the Source host or the Target host in the context of the assignments, but to the reference object unchanged on both sides of the assignment.
Value resolvers that ignore the input value and can only process the reference object (e.g. Template or XML export) do not access the Source host or the Target host, even within an assignment.


Configuration

Parameter

Description

Example

Target host
Value configuration

The value configuration for the Target host is optional.
The default value is the reference object in the execution context.


In the example (right), an Object property resolver defines an address field with the 'Address' (Address) entity type in the data model of the reference object in the execution context as a Target host, so that its fields can be used as Target values in assignments.

images/download/attachments/189441276/image-2024-12-9_9-25-13-version-1-modificationdate-1733732712739-api-v2.png

Source host
Value configuration

The value configuration for the Source host is optional.
The default value is the reference object in the execution context.


In the example (right), the company account that is considered the 'owner' (ownerId) of the reference object in the execution context is used as the Source host. Its fields can then be used as Source values in assignments.

images/download/attachments/189441276/image-2024-12-9_9-25-48-version-1-modificationdate-1733732747880-api-v2.png

Assignments

Any number of assignments can be added to the configuration using the images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg icon. The first instance is initially displayed in the user interface so that value configurations can be set up directly without having to click the images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg icon first.

The first assignment cannot be removed. However, the images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/forbidden.svg symbol for the instance deletes all value configurations.
All additional assignments are completely removed by clicking on the images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/forbidden.svg icon without further queries.

NOTE

  • The order of the assignments can be adjusted using drag & drop in the tree view (on the left in the editor), where each assignment is represented as an account with the label 'Set values > entry'.

  • It is not possible to make a complete assignment.

IMPORTANT◄ The assignments are processed at runtime from top to bottom, so it cannot be ruled out that changing the order of the assignments will produce different results with identical input data.

images/download/attachments/189441276/image-2024-12-9_9-27-15-version-1-modificationdate-1733732835255-api-v2.png

  • In the example, two assignments are used to transfer the values of two fields (city and countryCode) from the address in the account of the 'owner' company (see configuration for the Source host above) of an entity to the corresponding detail fields of the address of this entity (see configuration for the Target host above).

NOTE◄ The company account was specifically selected as the Target host here and not just its address field, although this would have simplified access to the Source values. The complete company account as a Source host makes it possible to also evaluate characteristics from the company account in value configurations for Source values in further assignments that are not contained within the address (address) or are included as an attribute (such as the 'Company type' and 'Parent companies' enumerations or the 'Meta company type' field).

Examples

Typical use case: Mapping of selected property values

Whenever a new user (see Users) is created, selected address characteristics from the address of the Company of session are transferred to their address:

    • 'Country' (countryCode)

    • 'ZIP code' (zipcode)

    • 'City' (city)

Configuration:

The screenshot on the right illustrates the configuration for event handling that reacts to the Triggering event 'New' (NEW) for all entities (see Common).


As a Validating rule, a Check type therefore ensures that event handling only takes place when a new 'User' (User) is created.


If the 'New' ribbon button is pressed in the context of a data input form for Users, a Set values event action with the following configuration should be executed as the only Action on passed rule:

  • Value configuration for a Target host: An Object property value resolver that defines the 'address' (address) of the new user as the input value for the value configurations of the Target values.

  • Value configuration for the Source host: A value resolver chain (see Chained resolver) that uses the Company of session to define its 'address' (address) as the input value for the value configurations of the Source values via Object property resolvers.

  • Three assignments are created that transfer the property values from the Source host to the Target object. As both pages refer to the same entity type (Address), the field names (left and right for each assignment) match. Source and target values are each addressed using Object property resolvers.

    • 'Country' (countryCode)

    • 'ZIP code' (zipcode)

    • 'City' (city)

NOTE◄ After clicking on 'New', the transferred data appears immediately in the input form, where it can be displayed and edited if necessary. Whether the 'enhanced' user account is saved or not is up to the user of the form.

images/download/attachments/189441276/image-2024-12-9_9-28-57-version-1-modificationdate-1733732937458-api-v2.png

Special use case: Access to the source host, target host and another reference object

Based on the previous example, a registered company should be given the option of creating several Users from a list in csv format via Batch import.

When creating the new user account, the 'Country', 'ZIP code' and 'City' address fields should again be assigned the corresponding values from the address of the Company of session.

Furthermore, a text value is assigned to the user account in the 'Match code' address field, in which the unique 'username' is linked to the value from the 'Match code' (accMatchCode) address field of the Company of session according to the following structure:

<username>@<company_address_accMatchCode>

Configuration:

The following screenshot shows how the mapping from the previous example can be extended to be reused in the context of an event handling that is triggered when a user account is 'created' (see Common) via Batch import.

NOTE◄ In contrast to the previous use case, where an empty user account should be enriched before displaying the unsaved data in a data entry mask, the Batch import provides some data (e.g. 'Username') for the user account to be created from the csv file. In the context of a CREATE action, the 'Create” event is automatically triggered during import. An event handling that reacts to this event can then 'revise' the data to be saved. The Validating rule of the event handling can use an AND junction with the absolutely necessary Check type (see above) to specify additional conditions that define when the synchronization of the address data takes effect at all.

images/download/attachments/189441276/image-2024-12-9_9-31-16-version-1-modificationdate-1733733075750-api-v2.png

  • The definitions for Source host and Target host as well as the first three assignments correspond exactly to the configuration from the previous example.

  • The fourth assignment is structured as follows:

    • As the Target value (left), in the same way as the other assignments, an Object property resolver references the 'Match code' (accMatchCode) field in the address of the user account that is defined as the Target host.

    • The Source value (right) is defined by a Concat strings resolver with three text components:

      • The first text component defines a value resolver chain (see Chained resolver):

        • A Variable value resolver to the current reference object provided by the system via the entity variable.

        • The concatenated Object property resolver can read the 'username' (username) field in this way, even though it is not contained in the company address provided as the Source host.

      • The second text component is the '@' separator defined as static text.

      • The third text component accesses the 'Match code' (accMatchCode) field in the address of the Company of session, which is defined as the Source host.

Special use case: Create list with values

For automated tests of an interface, certain geopositions are to be generated repeatedly at random in the context of a For each loop and assigned to a randomPosition variable.

The individual geoposition should be defined as a list of exactly two decimal numbers with a maximum of three decimal places, the first of which specifies the latitude with a value range of ±90° and the second the longitude with a value range of ±180°.

Configuration:

The screenshot on the right shows the configuration for a Set values event action that provides a random geoposition as a 'tuple' (list of two coordinates) in the randomPosition variable:

  • In the value configuration for the Target host, a Create instance resolver creates a new 'List' (List) instance, which is immediately assigned to the randomPosition variable as a value by the chained Store value as variable resolver.

  • A value configuration for the Source host is not required for the following assignments, as the Source values are 'randomized' using the Random long value resolver, which does not require an input value.

  • Exactly two list values are used as Target values, which are strung together in series using two instances of the List item resolver with the Mode 'Add (at the end)'.

NOTE◄ In principle, it would be advisable to create a client object structure with two named fields (e.g. lat and lon) instead of a list of anonymous coordinates, so that no unwritten convention (first value: latitude, second value: longitude) needs to be known in order to interpret the data correctly. However, the aim here is to demonstrate how flexibly and dynamically the Set values event action can be used to 'expand' a list available as a Target host. A Create instance with values resolver can also specifically address entries of a created list via discrete index values (0, 1, ...) as Target values. However, a dynamic 'Add (at the end)' cannot be achieved in this way.

images/download/attachments/189441276/image-2024-12-9_9-33-22-version-1-modificationdate-1733733202341-api-v2.png