Skip to main content

Document Generator

The flair Document Generator helps you save time when creating files such as offer letters, work contracts, employee onboarding documents, and more. It improves the consistency of your documents and reduces the risk of manual error by automatically populating employee data from Salesforce.

Creating a Document Template

Document templates allow you to create standardized documents with dynamic placeholders that automatically populate with data from Salesforce. Follow these steps to create a template:

Step 1: Access Document Templates

  1. Navigate to the Staff & Docs tab in the flair HR app
  2. Click on Document Templates
  3. Click the Create Document Template button

Step 2: Configure Template Settings

  1. Enter a Name for your template (e.g., "Employment Contract", "Offer Letter")
  2. Select an Object type from the dropdown (e.g., Employee, Candidate, Position)
    • This determines which Salesforce object the template will pull data from

Step 3: Prepare Your Template File

Before uploading, create your template document using Microsoft Word (.docx) or LibreOffice (.odt) format. You can use the following features:

Merge Tags

Merge tags are dynamic placeholders enclosed in square brackets [] that get replaced with actual data when you generate a document.

Basic Syntax:

[employeeName]
[startDate]
[jobTitle]

Best Practices:

  • Use camelCase naming (e.g., employeeName instead of employee name)
  • Avoid spaces in merge tag names
  • Match the exact field API name from Salesforce for automatic mapping

Example Template Text:

Dear [firstName] [lastName],

We are pleased to offer you the position of [jobTitle] starting on [startDate].
Your annual salary will be [salary].

Best regards,
[managerName]

Rich Text Formatting

You can use rich text in your templates with different colors, fonts, and sizes to make them look more professional.

Inline Rich Text - Use [~tag] with a single tilde (~):

  • Useful for replacing part of a paragraph without interrupting text flow
  • Example: The employee [~highlightedText] has excellent performance.

Block Rich Text - Use [~~tag] with a double tilde (~~):

  • Useful for replacing entire paragraphs with multiple elements like lists, tables, or formatted sections
  • Example: [~~performanceReview] could be replaced with multiple paragraphs, bullet points, etc.

Images

You can include dynamic images in your templates using publicly accessible URLs.

Basic Image Syntax:

[%logoUrl]
[%employeePhoto]

Image with Size Control:

[%companyLogo | size:200:100]
[%signature | size:300:150]

The size:width:height parameter ensures images maintain consistent dimensions (in pixels).

Image Requirements:

  • Images must be accessible via public URLs
  • Salesforce Static Resources can work if properly configured
  • Files stored within Salesforce (non-public) may not work due to authentication requirements

Example Use Cases:

  • Company logos
  • Employee signatures
  • QR codes for document verification
  • Product images
QR Codes

QR codes are supported just like images. Store the QR code URL in a Salesforce field and reference it with [%yourUrl | qrcode:['width']:['height']].

Salesforce Public URLs

Public URLs from within Salesforce (Static Resources, Files) may not work reliably as Salesforce often redirects to preview pages. Use external hosting or truly public Salesforce resources when possible.

Step 4: Upload Your Template

  1. Click Upload or drag and drop your .docx or .odt file
  2. Wait for the template to be processed
  3. Review the detected merge tags in the mapping interface

Step 5: Map Merge Tags to Fields

After uploading, you'll see all detected merge tags listed. For each tag:

  1. Select the corresponding Salesforce field from the dropdown menu
  2. For date fields, optionally specify a Date Format (e.g., dd/MM/yyyy, MMMM dd, yyyy)
  3. For rich text fields, ensure you're mapping to rich text field types in Salesforce
  4. For image fields, map to URL fields containing the image location

Example Mappings:

  • [firstName] → Employee: First Name
  • [startDate] → Employment: Start Date (format: MMMM dd, yyyy)
  • [%companyLogo] → Company Settings: Logo URL
  • [~~jobDescription] → Position: Description (Rich Text)

Step 6: Save and Test

  1. Click Save to finalize your template
  2. Test the template by generating a sample document
  3. Verify all merge tags are replaced correctly
  4. Check image sizing and formatting

Generating Documents from Templates

Once your template is created, you can generate documents for individual records:

From Employee Records

  1. Navigate to an employee record in the Employees or Staff & Docs tab
  2. Click on the Documents tab
  3. Click Add from Template
  4. Select your document template from the list
  5. Review the generated preview with populated data
  6. Click Save to employee documents to finalize

From Other Objects

The same process applies for other objects (Candidates, Positions, etc.):

  1. Open the relevant record
  2. Navigate to the Documents section
  3. Select Add from Template
  4. Choose your template and generate

Template Examples

Employment Contract Template

EMPLOYMENT CONTRACT

This Employment Contract ("Contract") is entered into on [contractDate]
between [companyName] ("Company") and [firstName] [lastName] ("Employee").

POSITION AND DUTIES
The Employee is hired for the position of [jobTitle] in the [department]
department, reporting to [managerName].

START DATE
The employment will commence on [startDate].

COMPENSATION
The Employee will receive an annual salary of [salary], paid [paymentFrequency].

COMPANY LOGO
[%companyLogo | size:200:80]

AUTHORIZED SIGNATURE
[%authorizedSignature | size:250:100]

Date: [signatureDate]

Offer Letter Template with Rich Text

[%companyLogo | size:180:60]

Dear [firstName] [lastName],

We are delighted to offer you the position of [jobTitle] at [companyName].

[~~offerDetails]

Your start date will be [startDate].

Best regards,
[~hiringManagerName]
[~hiringManagerTitle]

Generating Documents for Performance Reviews

You can use the Document Generator to export performance reviews as PDF or DOCX files. This allows HR teams, managers, and employees to download professional, formatted versions of completed reviews.

Creating a Performance Review Template

  1. Navigate to the Document Templates section.
  2. Choose the appropriate review type. You can create different templates tailored to specific review types, for example:
    • 360 Review: Includes input from peers, employees, and managers.
    • Standard Review: Limited to employee and manager feedback (no peer input).
    • Self-Review: Contains responses from the employee only.
  3. Configure fields like employee answers, reviewer comments, and peer responses.
  4. Adjust visibility settings based on your needs:
    • Semi-Visible: Only HR can view specific fields.
    • Optional Answers: Fields marked as optional will indicate "not required" when left unanswered.

Templates support dynamic fields that are pre-filled with mapped data like employee information, reviewer details, peer inputs, and answers. They also support complex data structures such as nested sections, multiple-choice questions, and conditional formatting.

Exporting a Performance Review as PDF

  1. Open the performance review in the flair HR app and click the Download PDF button.
  2. Select the desired document template.
  3. Preview the document before exporting to ensure accuracy.
  4. Choose to either download the document or save it directly to the employee's record for centralized documentation.
tip

Performance review templates are a one-time setup. Once configured, they can be reused for all subsequent reviews of the same type.

Advanced Features

Date Formatting

Customize how dates appear in your documents using format codes:

Format CodeExample Output
dd/MM/yyyy15/03/2025
MMMM dd, yyyyMarch 15, 2025
EEEE, MMMM dd, yyyySaturday, March 15, 2025
MM-dd-yy03-15-25

See the Salesforce date format documentation for the complete syntax reference.

Locale Settings

If dates or day names display in the wrong language, update your Salesforce locale:

  1. Click your Avatar (top right)
  2. Select Settings > Language & Time Zone > Locale
  3. Choose your preferred locale

Conditional Content

While direct conditional logic isn't supported in merge tags, you can use Salesforce formula fields to create conditional text:

  1. Create a formula field in Salesforce (e.g., Contract_Greeting__c)
  2. Use IF statements to create conditional content
  3. Reference the formula field in your template: [contractGreeting]

Example Formula:

IF(Department__c = "Sales", 
"Welcome to our dynamic Sales team!",
"Welcome to " & Department__c & "!")

Multi-Language Templates

For organizations supporting multiple languages:

  1. Create separate templates for each language
  2. Use naming conventions (e.g., "Contract_EN", "Contract_DE")
  3. Store language preference in employee records
  4. Select appropriate template based on employee language

Best Practices

Template Design

  • Keep merge tag names clear and consistent
  • Test templates with sample data before deployment
  • Include your company branding (logos, colors, fonts)
  • Use professional formatting and layout

Merge Tag Naming

  • Use descriptive names: [employeeFullName] instead of [name]
  • Follow camelCase convention consistently
  • Document your merge tags for team reference
  • Avoid special characters and spaces

Image Management

  • Host frequently used images (logos) on reliable external services
  • Use consistent image dimensions across templates
  • Test image URLs before deploying templates
  • Keep image file sizes reasonable for faster document generation

Content Organization

  • Group related templates together with clear naming
  • Version your templates (e.g., "Contract_2025_v2")
  • Archive outdated templates rather than deleting them
  • Document any special formatting or requirements

Troubleshooting

Merge Tags Not Populating

Issue: Merge tags appear as [fieldName] in the generated document

Solutions:

  • Verify the merge tag is mapped to a Salesforce field
  • Check that the field has data in the record
  • Ensure field permissions allow the user to view the field
  • Confirm merge tag syntax uses square brackets []

Images Not Displaying

Issue: Image placeholders show but images don't render

Solutions:

  • Verify the URL field contains a valid, publicly accessible URL
  • Test the URL directly in a browser
  • Check that the URL starts with https://
  • Avoid Salesforce internal file URLs (use external hosting)
  • Ensure image file format is supported (JPG, PNG, GIF)

Formatting Issues

Issue: Text formatting doesn't match the template

Solutions:

  • Use [~tag] for inline rich text preservation
  • Use [~~tag] for block-level formatted content
  • Map rich text merge tags to rich text field types in Salesforce
  • Check template formatting in the original .docx/.odt file

Date Format Problems

Issue: Dates display in wrong format or language

Solutions:

  • Specify date format explicitly in field mapping
  • Check Salesforce locale settings
  • Use correct format syntax (see Date Formatting section)
  • Verify the source field is a proper Date or DateTime field

Support and Resources

For additional help: