You are here:
Create a Multilevel Hierarchy Transformation for Document Generation
Create a nested hierarchy across groups, bundles, and products.
Required Editions
| Available in: Lightning Experience |
| Available in: Professional, Enterprise, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To configure multilevel hierarchy transformation for Document Generation: | DocGen Designer with Admin Persona |
Use Case: A quote contains parent groups and child groups, bundles within groups, nested bundle items, and standalone products. Use multilevel hierarchy transformation to represent relationships such as Quote → Quote Line Group → Quote Line Item and show nested structures in the document output.
Before you begin:
- Make sure that you’ve Set Up Data Transformation for Document Generation.
- Make sure you’ve a template that supports a nested hierarchy by using children.
-
Create a quote with groups, bundles, and nested items.
- Open the context definition.
-
Add nodes.
Each node represents a dataset that DPE processes independently. These nodes become Data Source Subtype nodes during transformation.
- Quote
- Quote Line Group
- Quote Line Item
-
Add relationship fields.
Hierarchy is built by using these identifiers. Parent Quote Line Group ID and Parent Quote Line Item ID turn on multilevel and self-referencing relationships such as group → subgroup → bundle.
- Quote ID
- Quote Line Group ID
- Parent Quote Line Group ID
- Quote Line Item ID
- Parent Quote Line Item ID
-
Configure field mappings.
DPE doesn’t infer relationships automatically. These mappings explicitly define how nodes connect, enabling correct parent-child linking across multiple levels.
-
In quote, map Quote ID to ID
-
In quote Line Group, map these references.
- Parent Reference in Quote Line Group to Quote ID
- Map Quote Line Group ID to ID
- Map Parent Quote Line Group ID to Parent Quote Line Group ID
-
In quote line item, map these references.
- Parent Reference in Quote Line Item to Quote Line Group ID
- Map Parent Quote Line Item ID to Parent Quote Line Item ID
-
In quote, map Quote ID to ID
-
From the Transform tab, select the transform you created.
When you open the DPE definition from the Transform tab, the Data Source node is preconfigured with the context data structure. It uses context as the source type, the selected context definition as the source object. It retrieves context data at run time based on the provided identifier, such as a Quote ID.The Data Source node and Data Source Subtype nodes are preconfigured and mapped to the context definition to retrieve context data at run time by using the Context Instance Identifier, such as the Quote ID.
-
Configure JSON writebacks:
Each level must independently define its hierarchy.
-
Quote Writeback
Quote is the root object and doesn’t require hierarchy. It acts as the container for all child records.
- For Source Node, select Quote.
- For Target Type, select JSON.
- For JSON Structure, select Simple.
-
Quote Line Group Writeback
Quote Line Group contains self-referencing relationships (group → child group). Hierarchy structure enables nesting across multiple group levels.
- For Source Node, select Quote.
- For Target Type, select JSON
- For JSON Structure, select Hierarchy
- Enter a JSON name.
- To configure the hierarchy configuration, set Parent Identifier to Parent Quote Line Group ID, and Record Identifier to Quote Line Group ID. Parent Identifier defines the parent-child relationship, and Record Identifier uniquely identifies each node. Together, they allow DPE to construct the hierarchy tree.
-
Quote Line Item Writeback
Quote Line Item supports nested bundles. This configuration preserves the bundle → sub-bundle → product hierarchy.
- For Target Type, select JSON.
- For JSON Structure, select Hierarchy.
- Enter a JSON name.
- Set Parent Identifier to Parent Quote Line Item ID, and Record Identifier to Quote Line Item ID to configure the hierarchy configuration.
-
Quote Writeback
-
Configure a Composite Writeback node:
Sequence defines how data is nested in the final JSON. Process parent nodes before child nodes.
- Set Target Type to JSON
- Define the sequence as Quote → Quote Line Group → Quote Line Item
-
Map relationships:
This mapping links datasets across levels. Without it, child nodes don’t attach to their correct parent hierarchy.
- Parent Field: Quote ID → Node Field: Parent Reference (Quote Line Group)
- Parent Field: Quote Line Group ID → Node Field: Parent Reference (Quote Line Item)
-
Save and activate the transformation.
-
Generate a document using the transformation.
- In the document template, for Context Transformation Name, select the transformation.
-
Make sure the template is configured to use nested structures such as related records and
children to render hierarchy levels.
DPE outputs a hierarchy in JSON by using related records (first level) and children (nested levels). The template must match this structure to render correctly.
-
Configure the template to show grouped sections by using the grouping field as the
header.
The template must reference the calculated field by using the alias defined in the formula node. The alias must exactly match the field name in the JSON output.
-
For the input, enter the Quote ID.
The Quote ID acts as the Context Instance Identifier to retrieve and transform data at run time.
-
Generate the document.
Este artigo resolveu seu problema?
Diga-nos para podermos melhorar!

