Building Templates - Magic Merge Knowledge Base

Building Templates

Templates are the foundation of Magic Merge. They define the structure and content of your generated documents. This guide covers how to create, customize, and manage templates effectively.

Template Basics

Magic Merge templates support multiple document formats:

  • Word (DOCX) - Contracts, letters, proposals, reports
  • Excel (XLSX) - Financial reports, data exports, spreadsheets
  • PowerPoint (PPTX) - Presentations, pitch decks, slide shows
  • PDF - Forms, certificates, finalized documents

Creating a New Template

Step 1: Start with a Document

Create your document in Microsoft Word, Excel, or PowerPoint. Design it exactly as you want the final output to look, including formatting, images, tables, and branding.

Step 2: Add Merge Fields

Insert Salesforce field references using the merge field syntax:

  • {{!Account.Name}} - Standard fields
  • {{!Account.Custom_Field__c}} - Custom fields
  • {{!Owner.Name}} - Related object fields
  • {{!TODAY}} - System functions

Step 3: Upload to Magic Merge

  1. Navigate to the Magic Merge app
  2. Click the Templates tab
  3. Click New Template
  4. Upload your document and configure settings
  5. Select the primary Salesforce object for the template
  6. Save and activate

Tip: Test your template with sample data before deploying to production to ensure merge fields render correctly.

Advanced Template Features

Conditional Content

Show or hide content based on field values:

{{#if Opportunity.IsClosed}}
Congratulations on closing the deal!
{{/if}}

Loops and Repeating Data

Display related records like line items:

{{#each OpportunityLineItems}}
{{ProductName}} - {{Quantity}} - {{TotalPrice}}
{{/each}}

Formatting Functions

Format dates, numbers, and currency:

  • {{!Account.AnnualRevenue | currency}}
  • {{!Opportunity.CloseDate | date:"MM/DD/YYYY"}}
  • {{!Contact.Name | uppercase}}

Images and Logos

Include dynamic images from Salesforce fields or static assets:

{{image Account.Logo__c width="200"}}

Template Management

Versioning

Magic Merge automatically versions templates. You can view history, compare versions, and roll back changes if needed.

Sharing and Permissions

Control who can use templates:

  • Public - Available to all users
  • Private - Only visible to the creator
  • Shared - Available to specific profiles or roles

Organizing Templates

Use folders and naming conventions to keep templates organized:

  • Group by department (Sales, Marketing, Operations)
  • Organize by document type (Contracts, Invoices, Reports)
  • Use descriptive names (Q1_Sales_Report_2024)

Best Practices

  • Start Simple - Begin with basic templates before adding complex logic
  • Test Thoroughly - Test with different record types and edge cases
  • Document Logic - Add comments to explain conditional statements
  • Maintain Consistency - Use standardized formatting across templates
  • Keep Backup Copies - Save original files before uploading to Magic Merge

Common Questions

Can I edit templates after uploading?

Yes. Download the template, make changes in Word/Excel/PowerPoint, then upload a new version. The template retains its ID and settings.

What happens if a merge field is blank?

By default, blank fields display as empty. You can configure fallback text or use conditional logic to handle missing data.

Can templates access data from multiple objects?

Yes. Use relationship notation to access parent and child objects (e.g., {{!Account.Owner.Manager.Name}}).

Need Help? Check out our template gallery for examples and pre-built templates you can customize for your use case.