-
Notifications
You must be signed in to change notification settings - Fork 4
Attribute change rule
The Attribute Change Rule provides granular control over business logic execution by detecting specific types of changes to individual attributes. This rule serves as a building block for implementing responsive workflows that react to specific data modifications while avoiding unnecessary processing.
Attribute change rules are fundamental building blocks in ACMA that allow you to create logic that responds specifically to changes in individual attributes. Unlike rules that simply check current values, these rules detect the type of change occurring, giving you precise control over when business logic should execute.
These rules enable several key capabilities:
Change detection for targeted logic: Rather than running logic on every object modification, you can create rules that only trigger when specific attributes are changed. This is essential for performance and for ensuring that related processes only run when truly necessary.
Building conditional workflows: Attribute change rules form the foundation for complex business logic by allowing you to differentiate between different types of modifications. For example, you might want different behavior when an email address is first assigned versus when it's updated to a new value.
Performance optimization through selective processing: By detecting only relevant changes, you avoid unnecessary operations when unrelated data changes. If your business logic only cares about department changes, you don't want it running every time someone's phone number is updated.
Change tracking: These rules let you monitor and respond to critical attribute modifications, enabling audit trails, notifications, or cascading updates when key data changes.
Foundational logic building blocks: Attribute change rules are typically combined with other rules in rule groups to create sophisticated conditional logic. They provide the "when something changes" component that other rules can build upon.
Understanding the different types of changes that can be detected is crucial for building effective attribute change rules. Each change type represents a specific transition state for an attribute value:
| Change Type | Description | Triggers When |
|---|---|---|
| Add | New value assigned | Attribute has no value and one is being added |
| Update | Existing value modified | Attribute has an existing value and it's being updated |
| Delete | Value removed | Attribute had an existing value and it's being removed |
| Any Change | Any modification | Add, update, or delete occurs |
| No Change | No modification | Attribute hasn't been modified |
Add is triggered when an attribute transitions from having no value to having a value. This commonly occurs during initial object creation or when an optional attribute is populated for the first time. For multi-valued attributes, Add triggers when the first value is added to an empty collection.
Update occurs when an existing value is modified or replaced. For single-valued attributes, this means the current value is being changed to a different value. For multi-valued attributes, Update triggers when the collection changes in any way - values added to an existing set, values removed from a set that remains non-empty, or values modified within the set.
Delete is triggered when an attribute loses its value entirely. For single-valued attributes, this means going from having a value to being empty. For multi-valued attributes, Delete occurs when the last value is removed, leaving an empty collection.
Any Change is a convenience option that triggers on Add, Update, or Delete - essentially any time the attribute value is modified in any way. This is useful when you need to respond to any modification regardless of the specific type.
No Change might seem counterintuitive, but it's valuable for validation scenarios where you want to ensure certain attributes remain stable, or for logic that should run only when specific attributes haven't been modified.
Rules can be configured to detect multiple change types simultaneously:
Example: Add OR Update
- Triggers on new values (Add)
- Triggers on modified values (Update)
- Does not trigger on deletions
| Change Type | Before | After | Rule Triggers |
|---|---|---|---|
| Add | null |
"John" |
✅ Triggers |
| Update | "John" |
"Jonathan" |
✅ Triggers |
| Delete | "John" |
null |
✅ Triggers |
| No Change | "John" |
"John" |
✅ Triggers |
| Change Type | Before | After | Rule Triggers |
|---|---|---|---|
| Add | [] |
["Group1"] |
✅ Triggers |
| Update | ["Group1"] |
["Group2"] |
✅ Triggers |
| Update | ["Group1", "Group2"] |
["Group1", "Group3"] |
✅ Triggers |
| Delete | ["Group1"] |
[] |
✅ Triggers |