Invoice Use Case

General Use Case


Tag can be used for content automation in all industries, to create many different kinds of documents. This use case describes how to automate a simple invoice document.

Looking at a paper invoice


Creating an invoice is a very common task. Invoices vary according to complexity (one detail item vs. many) and frequency (how often they are created).

Tag is well suited for simple invoices that are sent periodically for item purchases, consulting and other professional services.

This example will demonstrate how to automate a single invoice item which is subject to tax. It can easily be adapted to meet other requirements.


  • Reduce copy/paste errors
  • Ensure customer and order information is accurate
  • Use standard company header/footer and branding
  • Gather summary invoice data for year-end accounting

How is Tag used?

The following lists the main steps of this use case.

The starting point for most smart content projects is the desired output. What should the generated document look like, and what kinds of text fragments will be used to create it.

There are several different styles for invoices that can be found on the internet and then replicated in the template editor in Tag, which has the familiar look and feel of a word processor.

The invoice template file can also be created by importing an existing *.docx word processing document. If a suitable sample is available, this can be a time saver.

Tag also has ready-made samples that can be downloaded for different types of documents. You can download the Invoice sample, and then change the content and logic to suit your company’s needs.

Dynamic invoice data is as follows.

  • Customer information
  • Order information
  • Order number
  • Order date
  • Total including tax

Customer information often comes from a Customer Relationship Management (CRM) system like Salesforce, Zoho or Pipedrive. If you don’t have a CRM, then a simple CSV file (like an Excel spreadsheet) will work as well. In this example, customer information is obtained from a CSV file exported from a CRM that has 5 columns (Account, City, Country, Phone and Email).

The easiest way to start defining the above data in Tag, is to create a data setup file using the customer CSV. That only requires a few clicks and looks like this.
Data setup file for invoice data, created from CSV
Next other fields are added to represent order information. Now the invoice data looks like this.
Data setup file for invoice data, with all fields
The data fields gathered, and the naming convention used for fields, is entirely up to the author.

Calculated fields are defined when writing templates. In this case, the orderNumber, taxCollected and invoiceTotal fields can be automatically calculated for you at run-time. Tax collected and invoice total can be automatically calculated based on the price of the item and tax rate. Tax collected is stored in a data field to simplify year-end accounting (i.e., to make it easy to sum up for tax forms). Tag can also automatically insert the date the invoice is created and generate unique invoice numbers for each new invoice.

Calculated fields can be manually edited or overwritten, if necessary. For example, the form control for orderDate is a Date picker. This will cause a date picker to display in the form. Even though the field is calculated, you may simply select another date in the date-picker if the order date must be manually updated.

Data validation is based on form control types. This helps to prevent data-entry errors. For example, the itemPrice, taxCollected and invoiceTotal fields use a decimal box, while the tax field uses an integer box (to store the tax % value). The form will check that the data you enter matches these settings.

Finally, the itemDesc and detail* fields all use Text area controls to provide more room for typing. You can add as many item description fields as you like. And, if you have a common set of items or services that you often reference, these data fields can also be mapped to a spreadsheet (CSV) of descriptive data for the item or service, and then easily imported when you are creating an invoice.

Templates are created and edited in Tag using an editor with the familiar look and feel of a word processor. You can add headers, footers, tables, images, lines, borders and more. You can change font and color, add bold and italics, and keep track of your commonly used styles.

As invoices can share headers and footer with other office documents, it can be useful to store all your company branding, letterheads, and common fragments in a common file that can be referenced by several different templates for different types of documents. This use case supports that approach by creating two template files: branding and invoice.

The branding.xsl template file stores templates for header and footer. It is also a handy place for shared bits of content or logic. In this example, the header displays contact information and a logo.

The invoice.xsl template file is very simple. It has one start template that generates the invoice. It imports the branding template file and the invoice data setup file.

Calculated fields and data mapping are also defined in the template editor. You can find them under the File options menu above the document map.

This is what the four calculated fields look like in the sample invoice.

Calculated fields in template editor

The order number could be made much more flexible. It currently uses one prefix (MYCO) for all order numbers, but you can change how this is done. There are many other ways to approach this (don’t be shy, ask us how).

Notice the “Allow overwrite” checkbox shown above. Check this box to prevent the field from being automatically calculated more than once (you typically don’t want the Order number or Order date to change after they are initially stored, but the opposite is true for Tax collected and Invoice Total).

It is also convenient to add data mapping instructions to the template file, to make data entry using CSV files really easy.

Just select the desired CSV, specify a mapping file name, and view the mapping panel. Map the fields from the CSV to the fields in the data setup file and you are good to go! Here’s a screenshot of what data mapping looks like.

Mapping panel for customer CSV file

When you create a new invoice data file for your customer, Tag will automatically create the form for you to fill out based on the data setup files in use.

When a new data file is created, the calculated fields will run if they have sufficient information and auto-populate the form. The form might look like this.

Empty invoice form

Notice that the tax and total calculations are not able to run because no tax rate has been entered yet. When this situation occurs, you will be prompted to enter the missing data.

Unable to calculate warning message in form

Customer data is entered using the Auto fill feature. Since this mapping was setup in the report, a menu item already exists as shown below. It opens a wizard that lets you select a row from the customer CSV file.

Form with Auto fill menu item showing

Once all the data is entered, it is time to generate. Simply click the magic wand.

Generate page for an invoice

Generation creates a new word processing document and saves it to a file. You can select any file location that is visible to your computer, including cloud drives like Google Drive and Microsoft’s OneDrive. The generated document might look like this.

Screenshot of generated invoice

The generate page also allows for export of data. Data can be exported from one or more invoices into a single CSV file, making it useful for year-end accounting.

Benefits and outcomes

These are the goals for this use case.

  • Reduce copy/paste errors
  • Ensure customer and order information is accurate
  • Use standard company header/footer and branding
  • Gather summary invoice data for year-end accounting

When invoices are manually created, there is often quite a bit of copy/paste involved. Customer and order data may come from other systems, or get manually copied from other documents. Each time a piece of information is pasted, there is a chance of a mistake.

When customer data is imported from a CSV, there is no chance for errors like this. While in this example order data is entered manually, if possible pull it from another source using a CSV (highly recommended).

Calculated fields also help to reduce errors. In this use case, the order date, tax collected, invoice total and due date values will never be incorrect.

By saving headers and footers in a separate template file, reuse and standardization of company branding is improved. Other documents can reuse them with just a few clicks, and if changes are made you can trust that all affected documents are properly updated.

Exporting data makes sense for invoices. Having an accurate CSV that summarizes customer and order information can be valuable, and not just for year-end accounting. By adding fields that better describe your orders (e.g., add dropdown lists that describe shipping and/or order fulfillment in some way), you can improve team communication and add to your knowledge of how the business runs.

One final note about usage. If an invoice is only generated 1-3 times per month, it falls within the range allowed by the free Community subscription. That means you could do everything described within this use case for free, forever. We bet that once you’ve got invoices down to a few clicks, you will find other opportunities to automate content for your company.

How do I learn more?

Contact us for more information about this use case.