Docs‎ > ‎Reactive Logic Tutorial‎ > ‎

Bill of Materials Kit Explosion

Bill of Materials Kit Explosion
While described here as a separate topic, this is a requirement within Place Order.  When ordering a Product that is a kit (i.e., composed of other Parts, such as a plane with Wings etc), we want to reduce inventory for each of the components of the kit.

The key requirement is to populate the SubItems for a kit-based Lineitem.  See the database structure - subItems are a child of LineItem objects, representing the bill of materials explosion.  

The solution is to utilize the Insert Into From rule extension: see first action rule below.  The qtyOrdered rule computes computes the item quantity for kits (for non-kits, it simply returns / defaults the entered value).

The entire solution requires 4 rules:

Some of the lines above are summaries; we show the full logic here.  First, the complete event definition is shown below (this recursively creates the sub-items from each item):

The complete definition of quantity_ordered is a good illustration of conditional logic, here depending on whether the lineitem is a sub-item:

Click here to explore Bill of Materials Explosion.