You are here:
Create a Group by Transformation for Document Generation
Group line items based on selling model type.
Required Editions
| Available in: Lightning Experience |
| Available in: Professional, Enterprise, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To configure group transformation for Document Generation: | DocGen Designer with Admin Persona |
Use Case: A quote contains five line items, where three line items have selling model type set to evergreen and two line items have selling model type set to term defined. Use Group By transformation to show line items grouped by the model type 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 grouped sections.
-
Create a quote with varied selling model types.
- Open the context definition.
-
Add nodes.
- Quote
- Quote Line Item
-
Map the required fields in the Quote Line Item, including selling model types.
Grouping depends on the mapped attribute.
-
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.
Make sure that the model type is mapped in the context definition and selected in the subtype node.
-
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 Item Writeback
Quote Line Item is grouped based on selling model type to organize records into sections.
- For Source Node, select QuoteLineItem.
- For Target Type, select JSON
- Enter a JSON name.
- For JSON Structure, select Group
- Enter a JSON name.
- For Group By, select Selling Model Type to configure the group configuration.
-
Quote Writeback
-
Configure a Composite Writeback node.
Sequence defines how data is nested in the final JSON. Parent nodes must be processed before child nodes.
- For Target Type, select JSON
- Define the sequence as Quote → Quote Line Item.
-
Map Node Field to ParentReference (Quote Line Item field).
This mapping links datasets across levels. Without it, child nodes don’t attach to their correct parent hierarchy.
- Map Parent Field to Quote ID
- Map Node Field to Parent Reference
-
Save and activate the transformation.
-
Generate a document using the transformation.
- In the document template, for Context Transformation Name, select the transformation.
- Make sure that the template tokens align with the grouped JSON structure.
-
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.
Line items are grouped based on selling model type. Evergreen items appear together in one section, and term-defined items appear together in a separate section.
此文章是否解決您的問題?
請讓我們知道,以便我們改進!

