Get Access to the full Apex Classes for Prehook and Posthook examples
Get access to an Apex prehook class that demonstrates how to:
- Dynamically calculate a technical attribute (“MaxPayload”) based on other user-selected product attributes (like ‘Payload_Capacity_Requirement’, ‘Operating_Mode’, ‘TerrainAdaptationLevel’, and ‘MobilityType’) using custom logic and lookup maps directly within Apex. This allows for calculations far more complex than standard declarative rules.
- Persist this calculated attribute value back into the pricing context so it can be used by subsequent pricing rules or other processes.
- Systematically copy multiple attribute values (including the newly calculated “MaxPayload” and others like “Operating_Mode”) from the product’s attribute set directly onto corresponding custom fields on the parent Quote Line (or Order Line).
- Propagate these attribute values and the calculated “MaxPayload” field consistently from a parent (bundle) product to all its child line items (options/components), ensuring data accuracy across the entire product structure.
- Implement a crucial best practice: How to check the
dmlStatus
of each line item and skip processing for any lines marked as ‘DELETED’, preventing errors and ensuring the hook only operates on active lines. - Correctly structure the
dataPath
for updating bothSalesTransactionItemAttribute
nodes (the attributes themselves) andSalesTransactionItem
nodes (the line item fields) within the Revenue Cloud’s context API.
Get access to an Apex post-hook class that illustrates how to:
Ensure this custom description generation works accurately for both standalone products and products within bundles, including all child line items (options/components), by correctly sourcing attribute values based on the product hierarchy.
Read the final values of multiple product attributes (such as ‘Payload_Capacity_Requirement’, ‘Operating_Mode’, ‘MaxPayload’, etc.) from each quote line after all standard pricing calculations and any pre-hooks have completed.
Concatenate these diverse attribute values into a single, formatted descriptive string for each line item, providing a rich, consolidated summary of the configured product.
Update a standard or custom description field on each Quote Line (or Order Line) with this dynamically generated, comprehensive description.
Subscribe to keep reading
This post is free to read but only available to subscribers. Join today to get access to all posts.
Already subscribed? Log in