Policy Block

A policy describes what should happen when an event occurs and a condition is met.

When To Use It

Use a Policy block for event-driven follow-up behaviour: when Payment Authorized happens, Reserve Inventory; when Claim Approved happens, Issue Payment; when Appointment Cancelled happens, Release Appointment Slot.

Required Data

  • Name: readable rule phrase, such as Reserve Inventory After Payment.
  • Trigger event: the event that starts the policy.
  • Condition: when the policy applies.
  • Resulting command: command issued when the policy applies.
  • Owner: role or team responsible for the rule.

Recommended Data

  • Decision information: read model or external data needed to evaluate the condition.
  • Timing: immediate, delayed, scheduled, or retryable.
  • Failure behaviour: what happens when the resulting command fails.
  • Idempotency rule: how to prevent duplicate follow-up actions.
  • Audit wording: human-readable explanation of the automated decision.

Connections

Examples

  • When Order Paid, reserve inventory for every unreserved item.
  • When Payment Failed, start dunning sequence if the subscription is active.
  • When Claim Approved, issue payment if the beneficiary bank account is verified.
  • When Delivery Missed, create customer recovery task if the delivery is high priority.

Generation Notes

Code Genie uses policies to generate event handlers, workflow triggers, background jobs, retries, and automated command dispatch. Keep policies explicit so business automation remains visible on the canvas.