1. If you want to merge a section on your generated document based on a condition of a checkbox field, you can do this using the section merge feature in the template builder.
  2. For example, you could base the section merge from a standard checkbox field (true or false value) on your Opportunity to include or not include a services agreement section “Send Services Agreement.” If on the Opportunity, this checkbox field was checked (true), then this additional agreement section would merge onto the template. If this checkbox field was not checked (false), then this agreement section would NOT merge onto the document.
    1. Select the related checkbox field from in template builder. For this example, we are using “Send Services Agreement.”
    2. Then give your conditional section a name for this Conditional merge. Using our example, you could name this section “Services Agreement.”
    3. Once you type your section name, then click on “Start of Section” to the right next to your section name and it will modify the merge field code to: {!Opportunity.Send_Services_Agreement__c[SECTION_START:Services Agreement]}Copy this merge field code and paste it where you want the section to start on your template.
    4. Now go back to Section and select from drop down “End of Section” and copy the updated merge field code:{!Opportunity.Send_Services_Agreement__c[SECTION_END:Services Agreement]}Copy this merge field code and paste it where you want the section to end on your template. 
    5. Then type in any information you would to show on document (for our example this would be the verbiage from the “Services Agreement”) or you could place a merge field inside of section that you would want to display if value is true.
      Image for Conditional Merge - RS Documents Documentation
  1. Optionally, you could create a formula field to use this on an Opportunity record ONLY if there is at least 1 product related to the Opportunity.
    1. Create the section and content on template builder.
    2. Create a formula field with the type as checkbox on the object merging from such as the opportunity.  The formula field in our use case could be called “Line Items Exist”.  This formula would have an IF statement to check some logic on the record and return true or false.  This formula would have an IF statement to check some logic on the record and return true or false.
    3. Go to the template builder and now select the new formula field just created.  Then select to make that a conditional section.  Then copy that merge field code to place the starting of the section at the beginning of the section, and the end at the end of the section.
  2. You can also create a page break using this conditional section merge feature. Would look like this:
    [begin conditional section]

    <<add page break here>>
    [end conditional section]