Skip to content
← Back to Index

custom

A pass-through effect that is not processed by the platform. Custom effects are designed for inter-rule communication via triggerHook — hook listeners emit custom effects, and the calling rule collects them to decide what action to take.

Type

filtrera
{
  effect: 'custom'
  type: text
}

The record is open — additional fields beyond effect and type are allowed.

TIP

Custom effects are silently ignored by the platform's effect processor. They only have meaning when collected by a calling rule via triggerHook.

Usage

A hook listener emits a custom effect:

filtrera
param input: {
  hook: 'OnClaimResolve'
  orderId: uuid
  lines: [{ resolution: text, productNumber: text, quantity: number }]
}

import 'iterators'

from
  input.lines
  where l => l.resolution == 'replace'
  select l => {
    effect = 'custom'
    type = 'createReplacementOrder'
    productNumber = l.productNumber
    quantity = l.quantity
  }

The parent rule collects the custom effects via triggerHook:

filtrera
let hookEffects = { orderId = orderId, lines = resolvedLines } triggerHook 'OnClaimResolve'

let replacements =
  hookEffects
  where e is { effect: 'custom', type: 'createReplacementOrder' }

© 2024 Hantera AB. All rights reserved.