group
Keyword
group(key: text, label: text | nothing, dynamic: { text -> value } | nothing, effects: [CalculatedDiscount]): CalculatedDiscountGroup The group keyword attributes one or more discount effects from a promotion as one named commercial discount. It does not change the enclosed effects' evaluation order, target selection, price basis, rounding, or conflict behavior. It controls how their resulting calculated-discount allocations are labelled and reported.
key must be non-empty and unique among explicit groups returned by one promotion evaluation. A group accepts only calculated-discount effects, so a message effect or nested group is a component compile error.
When label is nothing, calculated discounts use the promotion description. When dynamic is nothing, they use the promotion dynamic fields. A supplied dynamic value replaces the promotion dynamic fields rather than merging with them.
Availability
| Promotion | Rule | Reactor | Egress |
|---|---|---|---|
| ✓ |
Example
let eligibleLines = target(e => e is OrderLine and e.dynamic->'isMember' == true)
from group(
'member-10',
'10% member benefit',
{ benefit = 'member', rate = 10% },
[percentage(eligibleLines, 10%)]
)To attribute two campaigns separately, return two groups with different keys. Effects returned without a group wrapper use the promotion's implicit default group.
See Also
- absolute — create fixed-amount discount effects
- percentage — create percentage discount effects
- Order Promotions — promotion lifecycle and grouping semantics