Creating a Conga Contracts for Salesforce Word Template

This documentation reviews creating a SOQL Query to retrieve Managed Clause data and building a Word Template for a Conga Contracts for Salesforce document.

The functionality discussed in this documentation requires active Conga Composer and Conga Contracts for Salesforce subscriptions.

Create a Contract document using Conga Contracts for Salesforce and Conga Composer. This requires the implementation of https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm, a Conga Composer button, and a Composer Word Template. The generated Contract document can be emailed and sent for negotiation with Conga Contracts for Salesforce.

After you have successfully integrated Clauses, Managed Clauses, and Clause Bundles with your Contract or alternative object, follow the steps below to build a solution that generates a Contract document. For more information on creating and structuring Clauses for a Contract document, see Creating Clauses for Conga Contracts Documents.

Create a Composer Button

Build a Conga Composer OAuth Button on the object whereManaged Clauses are referenced. Ensure that the Conga Composer button is placed on the object layout. For specific instructions on creating a Conga Composer button for Conga Contracts for Salesforce, see Create Composer Button To Generate Document for Conga Contracts and Create a Conga Composer OAuth Button.

Create SOQL Queries to Retrieve Managed Clause Data

Create a Conga Query record to retrieve Managed Clause data from your object. The syntax will be very similar to the example SOQL Query shown below aside from the listed variables.

Example SOQL Query Syntax: SELECT Id, APXT_Redlining__Latest_Revision_Text__c, APXT_Redlining__Order__cFROM APXT_Redlining__Managed_Clause__cWHERE Parent_Contract__r.ID = '{pv0}'AND APXT_Redlining__Clause_Type__c = 'Definitions'ORDER BY APXT_Redlining__Order__c ASC

Copy and paste the syntax above into the Conga Query record and account for the variables. Note, it is recommended to create individual Conga Query records for each Clause Type. This allows you to have separate data sets for each Clause Type in the Contract template and output document.

Variables for Managed Clause Queries

  • Reference the Managed Clause's Text field or Rich Text field.
  • The APXT_Redlining__Latest_Revision_Text__c field pulls in clause data from the Latest Revision Text field. This field does not include rich text formatting because it is not a rich text field. It is recommended to use the APXT_Redlining__Text_Rich__c field to render rich text formatting such as numbering, bullet points, italics font, and bold font. If you plan to use and merge rich text formatting with Managed Clauses, ensure that you reference the Latest Revision Text (Rich) field in the SOQL Query. It is not necessary to reference both Managed Clause fields in the SOQL query; only reference the text or rich text field depending on whether or not you are using the rich text field.
  • Change the referenced Object ID in the WHERE Statement.
  • On the third line of the example SOQL query, the Object ID field is also a variable. In the example above, this is the correct syntax for obtaining Managed Clause data that is related to the standard Contract object. If you are retrieving Managed Clause data related to an Opportunity the proper syntax is Parent_Opportunity__r.id. Ensure that correct object ID is accounted for in the SOQL Query.
  • Filter the SOQL query by Clause Type.
  • As previously mentioned, it is recommended to create an individual SOQL query for each Clause Type to provide easy categorization within the Contract template and output document. On the fourth line of the example SOQL query, replace 'Definitions' with the value of each Clause Type referenced your Managed Clauses.
  • See the portions of SOQL syntax below for an example of a Clause Bundle that has three Clause Types. Each example representative of an individual SOQL filtered by a specific Clause Type value.
    • AND APXT_Redlining__Clause_Type__c = 'Legal'
    • AND APXT_Redlining__Clause_Type__c = 'Fiscal'
    • AND APXT_Redlining__Clause_Type__c = 'Procurement'

Once the Conga Query records are created to retrieve the Managed Clauses, add the Conga Queries to your Conga Composer button using the QueryID parameter. This allows the Conga Composer button to retrieve the Managed Clauses datasets and successfully merge it with a Conga Composer Template.

Create a Word Template

After adding the QueryID parameter to the Conga Composer button, Conga Composer's Template Builder user interface allows you to access the Managed Clauses merge fields.

To build a Conga Composer Word Template for a Contracts document:
  1. Launch the Conga Composer button located on a Contract record or custom object record.
  2. In the Composer user interface, click Tools and Settings and then select Template Builder.
  3. Click the + button next to a Managed Clause dataset to expand the available merge fields.
    • The alias assigned to the ID of each Query in the QueryID parameter determines the name of the dataset.

      • Example: &QueryId=[DefClause]a03460000093Njb,[PayClause]a03460000093Njc creates two datasets availabe in the Template builder named DefClause and PayClause.
  4. Select the APXT_REDLINING_MANAGED_CLAUSE_LATEST_REVISION_TEST field or APXT_REDLINING_MANAGED_CLAUSE_TEXT_RICH field and use the right directional arrow to bring move it over to the right hand column.
  5. Copy the merge field syntax into the Word Document.
    • The merge field syntax will appear as {{TableStart:yourqueryalias}}{{APXT_REDLINING__MANAGED_CLAUSE_TEXT_RICH}}{{TableEnd:yourqueryalias}} or {{TableStart:yourqueryalias}}{{APXT_REDLINING__MANAGED_CLAUSE_LATEST_REVISION_TEXT}}{{TableEnd:yourqueryalias}}

    • Each Managed Clause dataset requires a unique TableStart and TableEnd value based on the alias assigned to the Query ID in the Conga Composer button URL. The merge field in the Word document must be referenced in between the TableStart and TableEnd. For more information, see Repeating Data in Word.

  6. Preview or Merge and Download the Word the template using the Local Template tab in the Conga Composer user interface. Ensure data successfully merges into the output Contract document
  7. After testing the merge fields, create a Conga Template record and attach the Word template. Associate the Conga Template record to the Conga Composer button using the TemplateID parameter.

Formatting in a Contract Word Template

Numbering and Hierarchical categorization is a recommended method to organize and merge Clause data in a Contract document's Word template. See the points below for tips and recommendations to best implement numbering and hierarchical categorization.I f hierarchical numbering or bullets are required within individual Clauses, format in the Clause's rich text field. The rich text field formatting renders successfully in the Word Template when using the HTML Word Function.