Configurator: Related Configured Items
The RelatedConfiguredItem feature allows a configuration to dynamically add other products to a quote or order. This is useful for systems, bundles, or offering conditional add-ons (like warranties or accessories) based on the primary product's configuration.
Overview
When you add a related item:
1. A separate Configurator instance is created for the related product.
2. The rules for that product are executed using the attributes you provide.
3. The resulting configured product is added as a new line item to the Quote or Order (stored in RelatedLineItems).
4. The components (BOM/SKU) of the related item remain attached to it and do not pollute the primary item's lists.
5. The LineItems collection on the result automatically includes both the primary item and these related items for display.
🚀 DSL Usage
The DSL provides a Fluent API for adding related items within the then block of a rule.
Basic Example
To add a related product with specific attributes:
then
config.AddRelatedConfiguredItem("WARRANTY-GOLD")
.WithAttribute("Duration", "3Y")
.WithAttribute("Coverage", "Full");
Automatic Configuration
You do not need to call .ConfigureAsync() in the DSL. The system automatically builds all requested related items once the primary configuration rules have finished executing.
Conditional Logic
You can use standard logic to decide when to add items:
when
var config = Configurator();
var accessories = Attribute_TXT(x => x.NameIs("IncludeCase") && x.ValueIs("Yes"));
var color = Attribute_TXT(x => x.NameIs("ProductColor"));
then
config.AddRelatedConfiguredItem("CARRY-CASE-01")
.WithAttribute("Color", color.Value);
Architectural Design
Isolation
The RelatedConfiguredItem is designed to maintain strict isolation between the primary item and any related items.
- Primary Item: Maintains its own Bill of Materials (BOM), SKU list, and Labor Tasks. This is the main item being configured and is stored in the
LineItemproperty of the result. - Related Item: Has its own independent BOM, SKU list, and Labor Tasks. These are stored in the
RelatedLineItemscollection.
This prevents "data pollution" where components of a warranty or accessory might accidentally show up as parts of the main machine.
Line Item Hierarchy
While the items are added as separate rows in the Quote/Order result, they are logically linked during the configuration session. The LineItems collection provides a unified view of all configured items (Primary + Related). If the primary configuration is re-run, the related items are typically cleared and re-evaluated based on the new state.