LCA Hooks
Learn about Life Cycle Action (LCA) hooks and when they run during an object's life cycle.
Life Cycle Hooks
Life Cycle Actions (LCA) hooks in Reltio allow you to define custom logic to be executed at specific points during the life cycle of an object, such as before saving or after deletion. By configuring hooks, you can ensure specific actions are taken automatically based on events, improving the automation and consistency of your data workflows. For more details on customizing data tasks with LCA, see topic Customize data tasks with LCAs
You can trigger LCAs against an external service, such as an AWS Lambda function, a Google Cloud function, an Azure function, or a dedicated LCA HTTP endpoint. You configure which hooks trigger which actions on the following object types:
- Entity types - most profile (entity) LCA hooks are configured here.
- Relationship types - the same hook names apply as for entities, except that the
validatehook applies when Reltio processes relations (links between entities). - Change-request types - only the
afterDCRSavehook applies to Data Change Requests (DCRs). Other hooks are not used for DCR objects in the same way.
- An instance of the
iReltioAPI(for sending REST requests to the API) - One of the implementations of
ILifeCycleData(for processing passed data)
These arguments apply to Java-based LCA implementations. If you are implementing an LCA in a non-Java runtime, such as Python or Node.js, you are responsible for parsing the request and formatting the response yourself. For more information, see Non-Java LCAs in Cloud Functions.
Configuration Patterns
You can configure hook actions in two ways.
Simple configuration - applies the same actions every time a hook fires. Hooks are keys, and values are ordered lists of actions to run in sequence. The following example shows hook actions in an entity type configuration:.
{
"beforeSave": ["MyBeforeSaveAction", "Lambda/BinaryJSON/MyLambda"],
"afterMerge": ["NotifyDownstreamAfterMerge"]
}
Conditional configuration - runs actions only when a filter condition evaluates to true Each item contains an actions list and a filter condition that must evaluate to true for the actions to run. The following example runs an action only when the request originates from the Reltio Console:
{
"beforeSave": [
{
"actions": ["UiOnlyEnrichment"],
"filter": "equals(clientType, 'Reltio UI')"
}
]
}
LCA Payload Models
Reltio sends different payload shapes to your LCA endpoint depending on the hook and operation type.
- Full business object payload - used for most save, update, cleanse, merge, and validate-style hooks. Your service receives the full business object, including attributes, crosswalks, and other metadata. Where supported, your service can return a modified object that the platform uses for subsequent processing or persistence.
- Identifier- and context-only payload - used frequently for matching hooks and potential match events. Typical payload contents include entity URIs, candidate match URIs, pairwise match URIs, tenant and type information, and an access token for downstream Reltio API calls. Your service can call Reltio APIs using the provided token if you need to load full records.
When LCAs Run
An LCA executes only when both of the following are true:
- The hook has at least one action configured for the relevant entity type, relationship type, or DCR type (for
afterDCRSave). - The API request does not explicitly disable LCA execution, where that option exists.
Life Cycle Action Hooks
rawDataBeforeCleanserawDataAfterCleansebeforeOverrideafterOverrideBeforeCleansebeforeGenerationafterGenerationbeforeSaveafterSavebeforeUpdateafterUpdateBeforeCleansebeforeDeleteafterDeletebeforeMergeafterMergebeforeUnmergeafterUnmergepotentialMatchesFoundpotentialMatchesRemovedbeforeNotAMatchSetafterNotAMatchSetbeforeNotAMatchResetafterNotAMatchResetbeforeMarkAsMatchafterMarkAsMatchbeforeUnmarkAsMatchafterUnmarkAsMatchbeforeReferenceAttributeAddedafterReferenceAttributeAddedbeforeReferenceAttributeChangedafterReferenceAttributeChangedbeforeReferenceAttributeRemovedafterReferenceAttributeRemovedafterDCRSavevalidate
beforeSave hook is called with one of the following ActionType as the parameter.CREATEUPDATEMERGESPLITVALIDATERECLEANSE
The beforeSave hook can run during validation or preview flows (for example, ActionType=VALIDATE). In these cases, LCAs execute before validation completes. If an LCA performs write operations, such as _update, /ignore, or delete, those writes are committed independently. These writes are not rolled back if a Data Validation Function (DVF) fails or the user clicks Cancel. As a result, changes can persist even when the save operation does not complete.
For example, during UI validation, when beforeSave(ActionType=VALIDATE) runs, if an LCA invokes _update or /ignore, the change may still persist even when DVF fails and the user cancels the operation.
To avoid this issue, do not perform write operations in beforeSave during validation or preview; run them only during the actual save operation.
Entity-specific Hooks
These hooks are only applicable to entities and their functionality is explained in the following steps:
- The
POST/entitiesAPI endpoint receives a list of entities to override. The entities are passed to therawDataBeforeCleansehook. Typical use cases include fixing data formats and encodings, rejecting clearly invalid payloads, and pre-enriching attributes that the cleanse step will depend on. - The Reltio API cleanses all the entities and then the second hook,
rawDataAfterCleanse, is triggered. Typical use cases include validating cleanse results and mapping cleanse output to internal or downstream conventions. - The Reltio API searches for matches (by auto rules or by crosswalks). If any matches are found, the
beforeOverridehook, is triggered. The Action Handler receives the following objects:- Raw data that came from the client
- Content of the object to be overridden
- After the override, the
afterOverrideBeforeCleansehook is triggered. Typical use cases include validating the combined contributor view before cleanse and preparing attributes for post-override cleansing. - Immediately before the
beforeSavehook, thebeforeGenerationhook is triggered. Typical use cases include adding or modifying crosswalks before auto-generation runs. - Reltio performs attribute auto-generation (for example, sequence or ID generation on
autoGeneratedattributes), and theafterGenerationhook is triggered. Typical use cases include inspecting or adjusting auto-generated values. - After the auto-generation, the
beforeSavehook is triggered. Typical use cases include data validation and business-rule enforcement, attribute and crosswalk enrichment, and invoking external masters or reference systems. - Reltio API saves the modified (or created, if there were no matches to override) object. After the object is saved into Cassandra, the
afterSavehook is triggered. This hook cannot make any changes to the object and also cannot cancel the operation. Typical use cases include publishing events, invoking webhooks, and updating downstream MDM, CRM, or analytics systems.
All Object Hooks
These hooks are applicable for entities, graphs, interactions, and groups.
Changing Object
Perform the following steps to change an object:
- After any change is made to the content of an object (such as attribute, role, tag, crosswalk added/modified/removed, and so on), the Reltio API loads the object. Before the object is modified, the
beforeUpdatehook is triggered. Typical use cases include deriving or auto-populating attributes and enforcing business rules before the change is applied. - After the object is modified, the
afterUpdateBeforeCleansehook is triggered. Typical use cases include adjusting values that should feed into cleanse and validating the merged view of the update before cleansing. - The modified object is cleansed. Immediately before the
beforeSavehook, thebeforeGenerationhook is triggered, Reltio performs attribute auto-generation, and theafterGenerationhook is triggered. ThebeforeSavehook is then triggered. - The Reltio API saves the object into Cassandra and runs the
afterSavehook.
Deleting Object
beforeDelete and afterDelete hooks are triggered. Typical use cases for beforeDelete include compliance checks (for example, legal hold), blocking deletes that violate policy or dependents, and pre-delete approval workflows. Typical use cases for afterDelete include emitting tombstone or deletion events, cleaning up references in external systems, and archiving or logging delete metadata.
Merging Objects
When several objects are merged, the beforeMerge and afterMerge hooks are triggered. The Reltio API cleanses the results of the merge and then saves the result to Cassandra. Appropriate hooks (afterUpdateBeforeCleanse, beforeSave, and afterSave) are triggered.
Typical use cases for beforeMerge include setting or correcting winner attributes, logging merge intent and rationale, and integrating with an external merge-approval or governance process. Typical use cases for afterMerge include notifying downstream MDM, CRM, or analytics systems that two identities have been merged, and updating master records or operational data stores.
Unmerging Object
If an object is unmerged, the beforeUnmerge hook is triggered, followed by the beforeNotAMatchSet and afterNotAMatchSet hooks. The beforeSave and afterSave hooks are executed for both the unmerged objects, followed by the afterUnmerge hook. The afterUnmerge hook receives both the objects as a result of the unmerge operation.
Typical use cases for beforeUnmerge include capturing audit snapshots and validating eligibility for split according to business rules. Typical use cases for afterUnmerge include updating external registries or downstream systems and emitting split-completed or unmerge events.
Potential Matches Found
If potential matches are found for an object, the potentialMatchesFound hook is triggered. Typical use cases include routing candidate pairs to a data steward queue or workflow, and scoring or filtering candidates in an external decisioning system.
Potential Matches Removed
If potential matches are removed for an object, for example due to profile changes or match graph evolution, the potentialMatchesRemoved hook is triggered. Typical use cases include closing tasks in external workflow systems and cleaning up downstream potential-match queues.
Mark as Match, Mark as Not a Match
If a client is asked to set Not a Match, remove Not a Match, or set Mark as Match, the following hooks can be triggered:
beforeNotAMatchSetafterNotAMatchSetbeforeNotAMatchResetafterNotAMatchResetbeforeMarkAsMatchafterMarkAsMatchbeforeUnmarkAsMatchafterUnmarkAsMatch
Typical use cases for the beforeNotAMatchSet and beforeMarkAsMatch hooks include enforcing policy or approval checks before the decision is recorded. Typical use cases for the corresponding after* hooks include notifications, audit logging, syncing decisions to external match registries, and updating golden records or downstream master systems. The beforeNotAMatchReset, afterNotAMatchReset, beforeUnmarkAsMatch, and afterUnmarkAsMatch hooks are typically used to align match overrides with external registries and to track or report overrides that may re-open candidates.
Reference Attributes Changes
If reference attributes are changed, the following hooks are triggered:
beforeReferenceAttributeAddedafterReferenceAttributeAddedbeforeReferenceAttributeChangedafterReferenceAttributeChangedbeforeReferenceAttributeRemovedafterReferenceAttributeRemoved
These hooks are triggered only for Relationship reference attributes, not for referenced entity reference attributes.
Use the following based on the type of validation required:
- If you need entity-level context, enforce the rule in an entity hook such as
beforeSaveorvalidate. - If the rule is relation-centric, store the required fields on the relation and validate them using a relation hook or a data validation framework (DVF).
Data Change Request Hook
The afterDCRSave hook runs after a Data Change Request (DCR) is saved, whether created or updated in storage. This is distinct from the standard entity afterSave hook. You configure this hook on the change-request type, not on a standard entity type.
Typical use cases include kicking off approval or review workflows and synchronizing DCR metadata with ticketing or case-management systems.
Validation Hook
The validate hook provides a dedicated hook for validation-only LCAs that return structured validation errors. It is typically used when your integration pattern is built explicitly around a validation contract.
This hook runs only when something in your environment explicitly invokes LCAs under the validate hook name, for example custom tools or APIs you enable. It is not invoked automatically on every standard create, update, or delete operation.
Standalone LCA Execution (What-If Scenarios)
Some APIs allow you to execute a configured LCA action against a supplied payload for a chosen hook, commonly beforeSave, without persisting data.
Typical uses include what-if validation from integration layers or the UI, testing rule behavior before committing changes, and external systems performing pre-checks using Reltio rules.
Design Guidelines for Customer Implementations
- Keep LCAs fast. LCAs frequently run synchronously on the request's critical path. Long-running actions increase API latency and raise the risk of timeouts and partial failures.
- Prefer idempotent
after*logic. Retries can causeafter*hooks to be invoked more than once for the same business event. Designafter*actions to tolerate duplicates where possible. - Use
before*hooks to block bad data. Return structured errors, as defined by your LCA contract, when policy requires stopping an operation. Exact behavior can depend on hook type and Reltio version; refer to your official product documentation for details. - Match the hook to your intent. Do not rely on
afterSaveto fix data that you intended to persist differently. UsebeforeSaveor earlier hooks, such asrawDataBeforeCleanseorbeforeUpdate, when the platform allows mutation of the working object. - Test with realistic volumes. Batch APIs can send many objects in a single LCA call. Ensure your service handles batching correctly, observes documented ordering guarantees, and scales for your expected throughput.
Attribute Generation Hooks
The beforeGeneration and afterGeneration hooks bracket the platform's attribute auto-generation step. During this step, Reltio populates values for attributes configured with an autoGenerated generator, such as a sequence or ID generator. Like other hook methods, each receives two arguments, which are an instance of IReltioAPI and an implementation of ILifeCycleObjectData.
For a given save operation, Reltio triggers beforeGeneration, runs the attribute auto-generation, triggers afterGeneration, and then triggers beforeSave.
LifeCycleActionBase provides a default no-op implementation for both hooks. Existing handlers that omit beforeGeneration and afterGeneration keep their current behavior.
Attribute generation runs immediately before beforeSave. A crosswalk that a beforeSave hook action adds to the object misses that generation pass and not receive a generated value. To generate a value for a crosswalk that hook logic adds, add the crosswalk in beforeGeneration instead. For the opt-in generateAttributePerCrosswalk tenant parameter, see Autogenerated IDs for simple and nested attributes.
beforeSave to beforeGeneration is an opt-in change. Enabling generateAttributePerCrosswalk is a separate opt-in. A beforeSave-based handler that adds crosswalks does not gain per-crosswalk attribute generation without both changes.