We’re experiencing NullReferenceException errors when running cost rollup calculations on our custom ItemType called ‘Assembly_Module’. The custom ItemType has a relationship to standard Parts through a custom ‘Module_Structure’ relationship. When we execute the Cost Rollup Method, it works fine for single-level BOMs but fails on multi-level structures (3+ levels deep).
The error occurs during BOM traversal:
System.NullReferenceException: Object reference not set
at Aras.Server.Core.CostRollup.TraverseBOM(Item bomItem)
at Aras.Server.Core.CostRollup.Calculate()
Our custom relationship setup includes cost_quantity and cost_factor properties similar to the standard Part BOM relationship. We’ve configured the Cost Rollup Method to use our Module_Structure relationship, but it seems the multi-level traversal isn’t recognizing child items properly. This is blocking our costing accuracy for complex assemblies. Has anyone dealt with custom ItemType cost rollup issues?
Another thing to verify - does your Module_Structure relationship have the sort_order property? Multi-level traversal algorithms often rely on sort_order to process child items in sequence. Without it, the recursion can fail unpredictably at deeper levels. Also check the quantity field mapping - if cost_quantity isn’t properly defined or has null values, the rollup calculation will throw NullRef when multiplying costs by quantities.
The multi-level traversal issue usually happens when the relationship configuration doesn’t match what the Cost Rollup engine expects. In Aras 12.0, the rollup algorithm recursively walks the BOM structure using specific relationship properties. Your Module_Structure relationship needs to have a get_related_item property that returns the child ItemType correctly. Without this, the traversal stops at level 2 and throws NullRef when trying to access non-existent child properties. Check your RelationshipType definition in the database - compare it line-by-line with the standard Part BOM relationship. Pay special attention to the source_type and related_type configurations.
I dealt with exactly this scenario last year. The problem is usually in the Cost Rollup Method’s BOM traversal logic not recognizing custom relationships. You need to modify the Method to explicitly query your Module_Structure relationship at each level. The standard implementation uses hard-coded ‘Part BOM’ references which won’t work for custom structures. Check if your Method has parameters for relationship_type_name - this should be set to ‘Module_Structure’. Also ensure child items have cost values initialized, even if zero, otherwise the calculation chain breaks.
I’ve seen this before. The Cost Rollup Method needs explicit relationship configuration in the ItemType definition. Check if your Module_Structure relationship has the ‘is_relationship’ property set correctly and verify that the related_id points to a valid source type. Also, make sure your custom ItemType has the cost and cost_rollup properties defined with the same data types as the standard Part ItemType.