Table of Contents

 

Guidelines for Template-based Invoice Customization

This document provides end-to-end guidance for Solution Partners and developers to effectively implement invoice customization using the template-based approach.

Traditionally, invoice customization in TallyPrime involved building complete invoice formats using TDL, often recreating layouts separately for each customer. This approach required significant effort and offered limited reuse.

TallyPrime Release 7.1 introduces template-based invoice customization, enabling a faster and more flexible way to design invoice formats for Print, Export, and Share. TallyPrime provides seven ready-to-use invoice templates within the product.

This approach enables developers to implement:

  • Configuration driven customization for most requirements
  • Reduced dependency on full TDL development
  • Faster delivery and improved maintainability
  • Consistent output across all channels

Template-based invoice customization fundamentally changes this approach. Instead of building from scratch, developers start with predefined templates, apply configuration-based changes, and use TDL only for advanced or specific requirements such as business logic or conditional behaviour. In addition, developers can create reusable templates that can be deployed across multiple customers, reducing development effort and improving standardization.

This shift improves consistency and enables faster delivery of solutions.

Key Principle:
Configuration should be the first choice, followed by extension, and development should be considered only when necessary.

Key Benefits

Template-based invoice customization enables TDL developers and solution partners to deliver invoice solutions faster while improving flexibility, consistency, and long-term maintainability.

  • Faster implementation and reduced effort
    Predefined templates eliminate the need to build layouts from scratch. Combined with automated handling of layout dimensions and aspect ratios, this significantly reduces development effort and speeds up delivery.
  • Reusability and scalability across customers
    Templates and their components can be reused and extended across multiple implementations, avoiding repetitive development and enabling scalable solution delivery.
  • Self-service and flexibility for customers
    Customers can make supported presentation changes, such as adding or removing fields, renaming labels, and adjusting layout without developer involvement. Flexible label and title customization ensures alignment with business terminology.
  • Dynamic and adaptable data presentation
    Field values can be dynamically bound using methods or expressions, allowing accurate and flexible runtime data rendering. Developers also have better control over Part sizing and compression for structured layouts.
  • Consistent and high-quality output
    A single template ensures uniform formatting across Print, Export, and Share. Built-in features such as watermark support and adaptive foreground color handling improve document clarity, branding, and readability.
  • Improved performance
    Optimized rendering with caching ensures faster invoice generation and smoother performance.
  • Easier maintenance and future readiness
    Templates can be extended for new requirements instead of being rebuilt, making it easier to maintain solutions and adapt to future changes or upgrades.
  • Focus on high-value development
    By minimizing effort on layout and presentation, developers can focus more on business logic, validations, and integrations.

Recommended Approach

When working on any invoice customization requirement:

  1. Understand the requirement: When working on invoice customization, it is important to follow a structured approach to ensure efficiency and maintainability. The process begins with clearly understanding the customer requirement and identifying whether it relates to presentation, data display, or business logic.
  2. Check if it can be achieved using templates: Once the requirement is understood, developers should first evaluate whether it can be achieved using existing templates and configuration options. In most cases, layout and presentation-related requirements can be handled without writing TDL. Configuration should always be the first step.

When to Use Templates vs TDL

Choosing the right approach is essential for efficient customization. Use templates when the requirement is related to:

  • Layout or presentation changes
  • Add or remove fields
  • Rename the labels or titles
  • Handling of branding (logo, theme, watermark)

Use TDL when the requirement is related to:

  1. Business logic or calculations
  2. Conditional display
  3. Custom validations
  4. Integration with external systems

It is also required when additional data needs to be introduced that is not available through standard template capabilities. In practice, most implementations involve a combination of templates for presentation and TDL for logic.

Template Architecture (How It Works)

Understanding how template selection and rendering work internally is important for implementation. When a user selects a template, the system stores its internal identifier (ViewName). During invoice printing, a switch evaluates this value and loads the corresponding form. The form then renders the invoice using its defined structure of Parts, Lines, and Fields.

User selects Template
        ↓
System stores ViewName
        ↓
Switch evaluates ViewName
        ↓
Matching Form loads
        ↓
Form renders Parts → Lines → Fields

Key Components

  • Template Object – Registers the template in the system
  • ViewName – Internal identifier used during selection
  • UserViewName – Name shown to the user
  • Switch Logic – Maps selected template to the corresponding form
  • Form – Defines the invoice layout

The template object is responsible for registering the template, while the Form defines the layout. The switch mechanism acts as the bridge between user selection and the rendered output.

Extend vs Create New Template

Scenario

Approach

Minor changes (layout, labels, branding)

Extend existing template using the options available in the template

Adding fields within existing structure

Either extend the existing template using TDL by modifying the part, line or field or by adding the custom fields in the selected sections.

Completely new layout or structure

Create new template (Explanation given below in Creating and Implementing a new template)

Industry-specific format with major changes

Create new template (Explanation given below in Creating and Implementing a new template)

A key decision during implementation is whether to extend an existing template or create a new one. If the requirement involves minor layout changes, branding updates, or adding fields within an existing structure, extending a standard template is recommended.

However, if the requirement involves a completely different layout or industry-specific structure that significantly deviates from standard templates, creating a new template may be more appropriate. In general, if most of the structure matches an existing template, it is better to extend rather than rebuild.

Creating and Implementing a Template

Creating a new template involves three simple steps: defining a template object, linking it to a form, and updating the default Printed Invoice form with switch logic.

The template object adds the template to the template list. The form defines the layout by reusing existing structures or creating a new one. The switch logic ensures the correct template is selected and used during invoice printing based on the template’s ViewName.

This approach is faster, more structured, and easier to maintain. It allows reuse of existing components, minimizes alignment issues through backend handling, and enables users to customize templates with minimal developer support—making it more flexible and efficient than the older method.

Print customization lets you create multiple templates based on country requirements. This means a single TDL/TCP file can be used across different countries with the correct formats, reducing the need to maintain multiple files and complex code.

Below are the steps to create a new template using the new print customization capabilities:

Step 1: Create Template Object

[Collection: VPC TMPL Custom Formats] is a default collection used to add new custom templates to the template list. The Object attribute is used to define and include a new template in this collection.

Example

[#Collection: VPC TMPL Custom Formats]

Object     : My Template

The Object definition is used to specify the required method names for adding a new template to the template list.

Example

[Object: My Template]                          

Use                   : VPC TMPL InvoiceFormatDocs

Country               : @@TMPLCountryIndia                  

ViewName              : “MyTemplate”                                    

UserViewName          : “My Invoice Template”                   

VarProfile            : “Tst New Template 1 Object Map”               

CarouselTitle         : “My Template”                                   

IsDefaultAppView      : No                                                

IsDefaultCmpView      : Yes    

Methods for Object:

  • Country: Specifies the country name for the template. This helps in filtering templates based on country, if required.
  • ViewName: Defines the template name used in the @@VPCTMPLSVPrintViewName Based on this, the corresponding option in [Form: Printed Invoice] is executed.
  • UserViewName: Sets the display name of the template that users see in the template list.
  • VarProfile: Accepts the name of an Object Map used to store changes made to variables in the template configuration. These changes are captured and saved in memory.
  • CarouselTitle: Defines the title displayed on the carousel slide for the template.
  • IsDefaultAppView: A mandatory attribute for the platform. On Save Template, it saves the configuration at the application level.
  • IsDefaultCmpView: A mandatory attribute for the platform. On Save Template, it saves the configuration at the company level.

Step 2: Create Template Form

For creating a new template, developers can either reuse parts from existing templates or build one from scratch. The backend properties automatically handle alignment, ensuring a consistent and error-free layout by default.

Example

[!Form: My Template Form]

Use      : VPC TMPL Sales

Reusing existing forms using the USE attribute, or using parts from default templates, allows developers to leverage pre-configured settings. This makes templates more flexible and easier for users to customize without relying on developers.

Overall, this approach simplifies the process and makes template creation faster and more efficient compared to the older invoice customization method.

Step 3: Link Template Using Switch

To use the new template, the Printed Invoice form must be modified with a switch for conditional execution based on the selected template name from the template list. When a user selects a template, the system matches the ViewName from the [Object: My Template] and loads the corresponding form to display the invoice.

Example

[#Form: Printed Invoice]                      

Add : Switch : At Beginning : MySwitch : My Template Form :

              +@@VPCTMPLSVPrintViewName = “MyTemplate”

Please restart the TallyPrime to view the new template in the Template List.

Step 4: Test the Template

After implementing a template, it is important to validate it across all output formats. Developers should ensure that the template appears correctly in the selection interface, loads the intended layout, and produces consistent output in Print, Export, and Share.

Special attention should be given to alignment, readability, multi-page handling, and visual consistency.

  • Verify template appears in selection: Ensure the template is listed in the template list and is available for users to select and use.
  • Ensure correct layout loads: Confirm that the selected template loads the correct format and displays the invoice properly.
  • Validate output across Print, Export, and Share: Check that the template works consistently across all output modes—Print, Export, and Share.

Reuse and Extension Guidelines

To ensure efficiency and consistency, developers should always reuse existing template components wherever possible. Standard templates already provide structured sections such as headers, company details, item details, and footers, which can be extended instead of recreated.

Customizations should be minimal and targeted. New components should only be introduced when existing ones cannot fulfil the requirement. This approach reduces complexity and improves maintainability.

Always reuse existing template components before creating new ones.

Component

Example

Definition Type

Base Template

VPC TMPL Sales

 Form

Header

VPC TMPL MLOne HeaderTheme

 Part

Item Details

VPC TMPL InvDetails

 Line

Footer

VPC TMPL FC Footer

 Part

Field Configuration Settings

Templates provide configuration options to customize field properties easily. You can add or remove fields or even create custom fields in specific sections. This makes it simple for developers to update existing templates based on requirements, without rebuilding the entire template. It saves time and effort in invoice customization. You can also change field properties like font, color, and background directly from the settings, reducing the need for additional coding.

The following options are available to configure the fields:

  1. Add/Remove Field – It provides a list of fields that can be added or removed based on your requirements from the settings. 
  2. Custom Field – It allows you to add custom fields in sections like Company, Footer, Party, and Invoice details without using TDL. These settings can be saved in the template for reuse. [Link]
  3. Font & Color – It allows you to change the font, font color, invoice theme color, and page background color easily. 
  4. Watermark – It allows users to overlay semi-transparent text or images onto documents This ensures brand authenticity, ownership, and status indication without obstructing the primary document data. For more information on watermark and its capabilities refer here.
  5. Edit Field Properties – It allows you to update field properties such as the title, text style (bold/italic), and the field’s color or background. 

Please refer to the TDL Enhancements for customizing print invoices. 

Role of Developers

With this approach, your role is to:

  • Select the appropriate base template
  • Configure it for customer requirements
  • Extend using TDL where required
  • Avoid rebuilding existing layouts

You also have to focus on efficiency, reusability and maintainability.

Real-World Implementation Scenarios

Template-based customization can be applied across industries by combining templates and TDL based on requirements. In retail scenarios, branding and presentation changes can be handled entirely using templates. In distribution, additional operational details such as transport information can be added using TDL within the template structure.

Manufacturing and pharma industries typically require item-level details such as batch numbers and expiry dates, which can be implemented using TDL. Service-based businesses often require simplified layouts, which can be achieved through template configuration. Export scenarios may involve additional shipping details, while construction businesses may require project or milestone-based billing, both of which can be handled using TDL extensions.

Across all these scenarios, templates handle presentation, while TDL is used selectively for data and logic.

Conclusion

Template-Based Invoice Customization enables developers and Solution Partners to deliver faster, more consistent, and scalable solutions. By using templates as the foundation and extending them only where necessary, developers can reduce effort, improve maintainability, and focus on delivering higher-value functionality.

Is this information useful?
YesNo
TallyHelpwhatsAppbanner
Is this information useful?
YesNo
TARA