Execute with

Event action – Abstract

Purpose: Executes event actions with an alternative reference object (entity).

The event action Execute with enables the temporary change of the reference object within an event handling in order to execute a block of event actions with an alternative reference object.

images/download/attachments/177911205/image-2024-9-12_15-52-0-version-1-modificationdate-1726149119904-api-v2.png

Parameter

Save Object in variable

The Save Object in variable parameter can optionally be used to specify the name of a variable that can be used to access the previous reference object while the alternative reference object applies.

NOTE

  • Assigning the previous reference object as the value of the variable named in the Save Object to variable parameter only affects the execution context within the Execute with block. After completion of the block, this variable is assigned the previously valid value again (possibly 'no value').

  • In general, however, assignments to variables are valid inside and outside the block. Another exception, however, is the variable managed by the system entity which always refers to the respectively valid reference object.

  • The label of the parameter reflects the type of the previous reference object. If a more specific entity type than 'object' results from the context of the configuration, its name appears before '... save in variable' and at the interface to the event actions.

Object resolver

The Object resolver defines the alternative reference object valid within the Execute with block for the execution of the event actions contained therein. After their completion, the previously valid reference object applies again.

In relation to the event actions executed within the Execute with block, the 'reference object' has the following significance:

  • If other events are triggered within the Execute with block, they receive the alternative reference object as 'Input value'.

  • Value resolvers that refer to an inbound object process the alternative reference object, unless otherwise specified. Thus, an Object property value resolver resolves a specific field of the alternative reference object if it is not used within a concatenation.

NOTE◄ The Execute with event action can be used in cascade to override the alternative reference object in steps. In each level of a cascade, there is access to the reference objects of the parent levels, provided that different variable names are used in the Save object in variable parameter in each case.

Event actions

In the block below the parameters, event actions can be added via the images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg symbol, which are executed at runtime with the alternative reference object.

Examples

Trigger notification to the owner of a business object

As soon as a business object of the 'Order' type (see Orders) is assigned the 'Released' working state, the company that is considered to be the owner of the order should receive an advice note.

The form of the notification should depend on the settings in the company account of the owner company. Details should control an event handling that reacts to a Custom action event ('Send advice') and expects the following data context:

  • As input value (entity) the company account of the company is to be passed, which – in the form defined in the company account – is to be notified.

  • A variable with the name order should contain the data of the order for which an advice note is to be sent.

The following configuration only shows how the notification is triggered using the Execute with event action. Notification details are omitted here.

  • The Triggering event here is the assignment of the working state 'Released' to any business object (Working state (Events)).


  • The Validating rule includes a Check type to ensure that event handling is only active for Orders.


  • Under Actions on passed rule, an event action of type Execute with is used here, which is essentially used to define the company account of the company that owns the just released order as a reference object.

  • Via the Save Order in variable parameter, the released order is first saved in the order variable.

  • The Object Resolver reads the field 'owner' (ownerId) from the order via an Object property value resolver and passes its value to the concatenated Input object (type safe) value resolver, which returns the respective company account.

  • The Company account is therefore the reference object for the following block of event actions. Only one Dispatch action event is required here, which triggers the 'Send advice ...' Event selected.

  • No value resolver needs to be specified for the Entity, since the Company account defined as the reference object serves as the input value of the event.

NOTE◄ An event handler that reacts to the 'Send advice ...' event also receives, together with the input value (company account), access to the variable order with the details of the order, which can therefore be used as the content of a message or also in connection with a Print document.

images/download/attachments/177911205/image2021-2-8_9-21-36-version-1-modificationdate-1726149008308-api-v2.png

Value assignments for multiple fields of the same object

Detailed data for a new flight are requested via a modal portal (see the following screenshot), which requires the IATA code and the ICAO code as required information:

images/download/attachments/177911205/image2021-2-8_9-25-52-version-1-modificationdate-1726149008303-api-v2.png

Clicking the Create button triggers a Custom action event, in the data context of which the form data shown below is passed as the value of the formData variable:

Form data (formData)
{
"codes": {
"IATA": "BER",
"ICAO": "EDDB"
}
}

For further processing, the following structure is to be created from the input in the form:

Target structure (newAirportObject)
{
"iataCode": "BER",
"icaoCode": "EDDB"
}

Configuration:

The transformation of the given form data into the target structure should be done within the event handling that reacts to the event triggered by the Create button in the portal.

Several fields must be transferred from the source structure in the variable formData into the fields of a target structure, which is to be newly created for this purpose in advance and stored in the variable newAirportObject.

The entire process can be implemented in an Execute with action as shown on the right:

  • In the Object Resolver, a value resolver of the Create instance type is first used to create a new Client object. This new data object is assigned to the variable newAirportObject via a concatenated value resolver of the Store value as variable type.


  • The new Client object is then used to make several value assignments via a Set value event action. The source fields (right) are read via an Object property value resolver, which accesses the Variable formData via concatenation.


  • The target field can be addressed by the Object property value resolver without concatenation, since the data object is considered to be an alternative reference object within the Execute with block.

NOTE◄ The parameter Save Object in variable (at the top) is not used here, because the portal does not provide an independent reference object anyway, but only the form data in the variable formData.

images/download/attachments/177911205/image2021-2-8_9-29-49-version-1-modificationdate-1726149008287-api-v2.png

Cascading use of "Execute with"

The cascading use of the Execute with event action is demonstrated here with a simple example. In practice, the 'nested' use of the event action often results in much more complex structures.

Based on the previous example, here is how an event handling could look like, which triggers the notification of a company, if a Custom action event of the type 'Send advice' is triggered.

The following configuration assumes that this event gets a company account as 'input value' and the data object of an order in the variable order as described above.

  • Due to a type check in the Validating rule not shown here, the event actions should only be executed if a Company account has been passed as a reference object.


  • This company account is passed to the variable company by the first step of the Execute with cascade, before the 'address' (field address) of the company is defined as an alternative reference object.

  • In the associated Execute with block, the next stage of the Execute with cascade already begins here by assigning the address to the Save address in variable in order to change the reference object again. Within the address a certain element within the 'Communication info' (plural attribute) is searched.

  • For this purpose, the Rule list resolver is used, which delivers the first match for the contained Entity property rule as a new reference object here. This looks for a value with the 'Context' (communicationContext) 'ADVICE'.

  • If Communication info with the context 'ADVICE' is found, further event actions are to be executed with this as reference object. As indicated here, a case differentiation according to the Communication type (e-mail, fax, etc.) is initially provided as an introduction to more concrete 'measures'.

REMARKS◄ Provisions for the possibility that no communication information with the context 'ADVICE' is found at all would be additionally recommended. The Execute with block is executed in this case with the value 'no value' (null) anyway.

images/download/attachments/177911205/image2021-2-8_9-41-51-version-1-modificationdate-1726149008283-api-v2.png