Billing: Custom Invoice

Knowledge Center > Workflow > Workflow Tasks > Billing: Custom Invoice

Billing: Custom Invoice

Table of contents

The custom invoice task generates an invoice based on the HTML template that you enter in the task, and then attaches the generated invoice to an object record. You can customize your invoice template using HTML tags, CSS, images, JavaScript and Liquid expressions.

For the task to run successfully, the invoice must be in "Draft" or "Post" status.

The generated invoice can be viewed in the output of the task or in Zuora UI.


You need to select or specify a field to identify the invoice and enter the complete template code. Ensure you retrieve invoice IDs in upstream tasks.


Use JavaScript or Liquid to add logic or data to the template. You can also reference external JavaScript libraries.

Liquid expressions start with '{%' and end with '%}'.

This code block uses Liquid to pass data to a JavaScript constant object.

const usages =  {% if Data.Usage %}
    {{- Data.Usage | to_json -}};
{%- else -%}
{%- endif -%}

The following code block adds data to a div element. Depending on the value of a data field, it adds different strings to the div element.

 <div style='font-size: 10px'>
{%- if Data.Invoice[0].InvoiceNumber and Data.Invoice[0].InvoiceNumber != "" -%} 
{{- Data.Invoice[0].InvoiceNumber }}
{%- else -%}0001{%- endif -%}


If the task runs successfully, you can view the output in the Tasks tab. Click the menu icon on the left of the task and hover on Files. You can select either the HTML or PDF version of the invoice. The PDF file is generated based on the HTML file. If you want to do one-time changes, you can modify the HTML file and then generate a PDF file based on the HTML file. 


You can also view the PDF in Zuora UI. It is shown in the History section of the specific invoice. 

Last modified



(not set)