Skip to main content
Conga Support

Merging Sub Clauses into a Contract Document with Composer

To merge Sub Clauses into a contract document, you must create a Nested SOQL Query and a Nested Detail Region, which allows you to merge repeating data (Clauses) within repeating data (Sub Clauses).

We recommend familiarizing yourself with Nested SOQL Queries and nested tables in Word documents.

The following is an example of a Nested SOQL Query that gathers the basic information for a Parent Clause and its related Sub Clauses (filtered on a specific Contract record):

SELECT APXT_Redlining__Latest_Revision_Text__c, Id, APXT_Redlining__Order__c, 
            (SELECT ID, APXT_Redlining__Latest_Revision_Text__c, APXT_Redlining__Order__c 
                        FROM APXT_Redlining__Managed_Sub_Clauses__r 
                        ORDER BY APXT_Redlining__Order__c ASC
            )
FROM APXT_Redlining__Managed_Clause__c 
WHERE Parent_Contract__r.ID = '{pv0}' 
AND APXT_Redlining__Clause_Type__c = 'System Access' 
ORDER BY APXT_Redlining__Order__c ASC

Additionally, you need to create a Nested Detail Region in your contract document template to merge the data from the nested query. The table containing your clauses may look like this:

nestedclausetable.jpg

In the above screenshot, notice the two sets of {{TableStart}} and {{TableEnd}} merge fields, one within the other. This is what makes it a nested Detail Region. Upon merge, the corresponding nested SOQL Query populates the table with the results of the query, which is built to retrieve two sets of repeating data.

Lastly, in this example the template is utilizing auto-numbering in Word, which dynamically numbers the Clauses and Sub Clauses (3.1, 3.2, 3.3, etc.).