For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to Show or Hide Content Automatically

Show or hide template sections with field checks, blank-value rules, and multi-part conditions.

Use this tutorial when one template must generate different output for different records.

What it looks like

After setup, one quote can produce all of this:

  • A VIP message only for high-value customers

  • A phone line only when Contact.Phone has a value

  • A California clause only for active contracts

  • A finance compliance note only for matching industries

  • Reusable rule patterns for other templates

This works well for quotes, contracts, and renewal documents.

When to use conditional logic

Use conditional logic when content should appear only when record data passes a rule.

Best for:

  • Hiding empty labels and optional sections

  • Showing regional or industry-specific clauses

  • Reusing one template across several customer scenarios

Use another feature when the job is different:

Build a quote template with conditional logic

What you'll configure

  • A basic RENDER block

  • Empty-field checks with != 'NULL'

  • Multi-part rules with && and ||

  • Keyword matching with CONTAINS

  • A quick test plan for validating output

Estimated time: 20 minutes

Prerequisites

Before you start, make sure you have:

  • Access to S-Docs Templates

  • Permission to create or edit templates

  • An S-Docs template related to Account, Contact, or Opportunity

  • Test records with known field values

  • Basic familiarity with merge fields such as {{!Account.Name}}

If you are brand new to S-Docs syntax, start with a merge field tutorial first.

1

Step 1: Open or create the template

Start with a template that should change by record data.

  1. Go to S-Docs Templates in Salesforce.

  2. Open an existing template or click New Template.

  3. Set the correct base object.

  4. Open the template editor.

  5. Click Source if you want to paste syntax directly.

You now have a place to add conditional blocks.

2

Step 2: Add a simple equality check

Start with one short block. This confirms the syntax works before you add more logic.

Add this where the VIP note should appear:

What you just did:

  • Compared Account.Customer_Type__c to one exact text value

  • Used == for an equality check

  • Rendered the paragraph only when the condition passes

How to read the syntax:

  • {{!Account.Customer_Type__c}} is the field being checked

  • == means the value must match exactly

  • 'High Value' is the required text

3

Step 3: Hide a blank phone line

Use a null check when the label and value should appear together.

Add this block in the contact section:

What you just did:

  • Used != for a not-equal check

  • Compared the field to NULL

  • Prevented an empty Phone: label from printing

This pattern works well for phone, email, title, and address lines.

4

Step 4: Require two conditions with AND

Use AND logic when both checks must pass before showing content.

Add this clause below the customer summary:

What you just did:

  • Used && for AND logic

  • Grouped both checks with parentheses

  • Rendered the clause only when both values match

Read the condition in order:

  • BillingState must equal CA

  • Active_Contract__c must equal True

  • && means both statements must be true

5

Step 5: Match either value with OR

Use OR logic when one of several values should show the same content.

Add this example:

What you just did:

  • Used || for OR logic

  • Allowed either state to trigger the note

  • Reused the same field in two checks

Use this pattern for state groups, segment groups, or status groups.

6

Step 6: Match a keyword with CONTAINS

Use CONTAINS when the source text can vary.

Add this block in the compliance section:

What you just did:

  • Searched within the full field value

  • Matched text like Finance Team or Global Finance

  • Avoided relying on one exact field value

If you need the inverse, use NOT CONTAINS.

7

Step 7: Save and test the output

Test one rule at a time before combining more patterns.

  1. Click Save in the template editor.

  2. Generate the template from a record that should pass one rule.

  3. Generate it again from a record that should fail.

  4. Compare the output blocks.

Verify these results:

  • The VIP note shows only for high-value customers

  • The phone line shows only when Contact.Phone is populated

  • The California clause shows only when both checks pass

  • The finance note shows only when the keyword exists

Try these variations

Use these once the base version works.

An amount threshold:

A negative keyword match:

A combined customer and industry check:

Guardrails and limits

Syntax rules

  • Always close each block with <!--ENDRENDER-->.

  • Always keep the full label and value inside the same block.

  • Always use exact field API names.

  • If you miss the closing tag, later content can disappear.

Operator rules

  • Use == for exact matches.

  • Use != 'NULL' for blank-value checks.

  • Wrap multi-part conditions in parentheses.

  • If the operator is wrong, the block stays hidden.

Text-matching rules

  • Match text values exactly when you use ==.

  • Use CONTAINS when field values vary.

  • Check capitalization and spacing in test data.

  • If the value differs, S-Docs skips the block.

Testing rules

  • Generate one document after each major syntax change.

  • Test one condition alone before combining conditions.

  • Use records that clearly pass and fail each rule.

  • If you skip this, debugging gets much slower.

Last updated

Was this helpful?