Skip to main content

Document Templates

Document templates are pre-structured documents that contain placeholders for dynamic data, allowing personalized documents to be generated automatically. Instead of manually copying and editing documents each time specific data needs to be inserted such as invoices, contracts, or order summaries document templates streamline this process by integrating with data sources like Salesforce records.

With tools like DriveMate, you can create Google Docs as templates with placeholders that represent data fields from Salesforce. During document generation, these placeholders are replaced by actual record specific information, producing customized documents efficiently and accurately.

This automation eliminates repetitive manual work, reduces errors, and speeds up generation of business critical documents, ensuring that the final files are stored directly in designated Google Drive folders linked to your Salesforce records.

Structure of a Document Template

A typical document template contains:

  • Static Content: Fixed text and layout such as titles, headers, footers, logos, and legal text.
  • Placeholders: Merge fields embedded within this static content act as variables. They are formatted using Salesforce formula syntax, enclosed in delimiters {! ... }.

Example placeholders include:

  • {!Account.Name} — inserts the account's name.
  • {!TODAY()} — inserts the current date.
  • Conditional formulas like: {!IF(Account.AnnualRevenue <= 100000, "Small", "Medium")} classify account size based on revenue.

Additional advanced placeholders allow:

  • Merge fields: dynamic placeholders embedded within templates that pull and display specific data from Salesforce records during document generation.
  • Formula Functions: Complex transformations and computations embedded in the template.
  • Rollups: Aggregation of related records, e.g., counting related opportunities or cases.
  • Record tables: Dynamic tables sourced from multiple related records.
  • Conditional sections: Document parts included or excluded based on specific data conditions.