Conditional Execution of LCA

You can configure your LCAs for conditional execution.

Conditional Execution

Sometimes, before executing an action, the LCA needs to validate a condition and then execute the action only if the condition is true. In such cases, administrators can configure a condition for a particular LCA so that the LCA is triggered only if this condition is satisfied.

Specifying a condition for an LCA and executing it only when this condition is met can be beneficial in terms of performance, especially in cases where the condition is not met often. For example, if we have an LCA that generates some ID, it is recommended to run this LCA only when the object does not exist.
Note: During the initial data load, entities do not have IDs. However, during incremental data loads, when most of the input entities are updates of the existing ones (that already have IDs), the LCA is executed only for the new entities.

Applying Filter for Action

In some cases, LCA must be executed by a condition. For example, for conditions that makes requests only from the UI, You can specify a filter in the configuration.

Filter by clientType

You can configure LCA to run only after requests from UI while ensuring that LCA is not triggered for other activies, such as data loads. In this case, we can apply filtering by clientType for the LCA.

Let us consider the following example illustrating the use of filter in LCA configuration:

"lifecycleActions": {
  "beforeSave": [
    {
      "actions": [
        "LCAGroupA"
      ],
      "filter": "equals(clientType, 'Reltio UI') and equals(attributes.Group, 'GroupA')"
    }
  ]
}

In this example, the LCAGroupA-beforeSave hook is triggered only if a user tries to create or modify an entity using UI and this entity has the Group attribute with the GroupA value.

Note:

clientType is a value that is passed to the API as globalId in the request header. Consider the example listed below.

Request:

POST /reltio/api/tenantId/entities/entityId

Headers:

Host: env.reltio.com
Connection: keep-alive
Source-System: Reltio
xxx-client: true
globalId: Reltio UI
Authorization: Bearer token
clientSystemId: Reltio UI
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
X-Requested-With: XMLHttpRequest
Accept: */*
Referer: https://env.reltio.com/ui/tenantId/
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8
Cookie: cookies
Note: Bulk update tasks created using the UI do not pass the header globalId to LCA.