Introduction
Letter templates in uKnowva HRMS allow HR professionals to automate and personalize employee letters such as offer letters, confirmation letters, and appraisal letters with ease.
One of the key features that enhances this functionality is the use of Twig, a powerful templating engine.
Twig allows you to dynamically include data fields, conditional logic, loops, and formatting directly within the letter templates.
This makes it easier to create smart, reusable, and highly customized letter formats without manual editing every time.
In this guide, we’ll walk you through the detailed steps to use Twig in letter templates and explain how it helps you streamline your HR communication.
Step 1: Accessing the Letter Templates Page
To begin, go to the left-side navigation panel and click on the HR menu. From the list of sub-menus that appear, select Letter Templates.

This will open a new page displaying a list of all the existing letter templates.

If you want to create a new template, click on the + Add New Template button located at the top-right corner of the page.

This will open a form where you can start configuring your new letter template.

Step 2: Configuring the Basic Details
Once the new template form opens, start by entering the required details, such as Title, which will be the name of your template, and Accessible To, where you can select the user groups that should have access to this letter template.

Next, you’ll find an option to Enable Password Protection. You can toggle this to “Yes” if you want to secure the template.
When enabled, you can set the password as either static (same for all users) or dynamic (varies for each user).

These settings ensure that only authorized users can view or modify the letter content.
Step 3: Creating the Header and Body Using Twig
After filling in the basic details, move to the Header section.

Here, you can enter literals or predefined content such as your company name or address. You can also refer to the list of available literals below to insert dynamic values such as employee name, ID, or designation.

Next, proceed to the Body section, which is the main content area of your letter.

You can either write the content manually or use the Generate with AI feature to automatically create a letter based on your title.
To use AI generation, simply enter the title and click on the “Generate with AI” button.

This helps you save time and get a ready-to-edit draft instantly.
Inside the editor, you can add content, code, or literals and make use of Twig components.
To add Twig, click on the Twig drop-down menu, which provides a variety of options such as Twig For Loop (Table), Twig If Condition, Twig Elseif Condition, Twig Else Condition, Twig Current Date, Twig Variable Output, Twig Uppercase Filter, Twig Lowercase Filter, Twig Date Format Filter, and Twig Comment.
These options allow you to dynamically control how data is displayed in your template.
For example, if you want a certain line to appear only when a specific condition is met, you can use the Twig If Condition component.
When you select this, the editor will show a default code snippet like:
{% if row.field.testfield %} ... {% endif %}
You can then edit this snippet as per your requirement.

Twig makes your templates smart and interactive. For instance, you can use loops to display tables of data, format dates, or convert text to uppercase or lowercase automatically.
It helps create responsive templates that adapt to the data being inserted — eliminating the need to manually adjust each letter.

Step 4: Adding and Formatting Other Components
Beyond Twig, you can further customize the template by adding images, media files, or HTML snippets.
You can also format the text, adjust fonts, add headings, or create lists such as bullet points, numbered lists, or to-do lists.

This flexibility ensures that your letters not only contain accurate information but also maintain a professional look and feel.
Once you’re done with the body, move on to the Footer section.

Here, you can enter closing statements, signatures, disclaimers, or additional literals.

The footer works similarly to the header and can include dynamic data if needed.
Step 5: Applying Additional Settings and Saving the Template
In the Additional Settings section, you’ll find more customization options such as adding Custom CSS, setting Auto Margin Padding, adjusting Top and Bottom Margins, selecting Orientation (Portrait or Landscape), and choosing the Format (e.g., A4).

These options give you complete control over the layout and presentation of your template.
Once you’ve reviewed and finalized all the details, click on the Save button to store your template. If you wish to discard your changes, simply click on the Cancel button.
Step 6: Using Twig Helper Functions for Advanced Template Customization
In addition to standard Twig components, uKnowva HRMS also supports Twig Helper Functions, which provide advanced capabilities for dynamic data handling and template customization.
Twig helper functions can be used for tasks such as formatting values, manipulating text, fetching additional data, performing calculations, handling conditional outputs, and customizing how information is displayed within the document.
This is especially useful when creating sophisticated templates such as salary letters, appraisal letters, policy documents, or employee-specific communication where data presentation needs to be controlled dynamically.

For example, helper functions can be used to format dates in a specific format, display values conditionally based on employee data, or manipulate text outputs automatically before rendering them in the final document.

If you want to learn more about the available Twig Helper Functions and how to use them in detail, you can refer to this tutorial article.
Conclusion
That’s it!
You’ve now successfully created a letter template using Twig in uKnowva HRMS.
By incorporating Twig, you can automate dynamic data insertion, control conditional content, and create flexible, reusable templates that save time and reduce manual work.
If you have any questions or need additional support, feel free to contact us at This email address is being protected from spambots. You need JavaScript enabled to view it..



