Skip to main content

Define date and numeric formats in HTML templates

Zuora

Define date and numeric formats in HTML templates

The HTML Templates feature is generally available for invoices as of Zuora Release 2022.02.R2, and for credit and debit memos as of Zuora Release 2022.05.R1.

With the HTML templates feature, you can use merge fields to define date and numeric formats. This tutorial takes invoices as an example; the configuration is similar for credit memos and debit memos.

By default, dates are displayed as plaintext, without the localization based on locale; the value of a numeric field is displayed as a number without the localization.

To format date fields or numeric fields per locale, use the Localise(locale_NAME) function. For more information about this function, see Localise function for more information.

Assume that an account uses the communication profile with the locale English (United States). The following table lists some date field examples for how the date of February 14, 2021 is localized according to different locales.

Merge field Display on PDF files Notes
{{Invoice.InvoiceDate}} 2021-02-14 Without the localization.
{{Invoice.InvoiceDate|Localise}} 02/14/2021 Localized per the default locale (English - United States) from the communication profile
{{Invoice.InvoiceDate|Localise(fr_FR)}} 14/02/2021 Localized per locale fr_FR
{{Invoice.InvoiceDate|Localise(it_IT)}} 14/02/2021 Localized per locale it_IT
{{Invoice.InvoiceDate|Localise(de_DE)}} 14.02.2021 Localized per locale de_DE

 The following table lists some numeric field examples with localization according to different locales.

Merge field Display on PDF files Notes
{{Invoice.Amount}} 12430.64 Without the localization.

{{Invoice.Account.Currency|Symbol}}  {{Invoice.Amount|Localise}}  {{Invoice.Account.Currency}}

Or

 {{#Invoice}}{{Account.Currency|Symbol}}  {{Amount|Localise}}  {{Account.Currency}}{{/Invoice}}

$ 12,430.64  USD Localized per the default locale (English - United States) from the communication profile

{{Invoice.Account.Currency|Symbol}}  {{Invoice.Amount|Localise(de_DE)}}


Or

 {{#Invoice}}{{Account.Currency|Symbol}}  {{Amount|Localise(de_DE)}}{{/Invoice}}
€1.234.567,89 Localized per locale German - GERMANY. Currency is European.

{{Invoice.Amount|Localise(it_IT)}}  {{Invoice.Account.Currency}}


Or

 {{#Invoice}}{{Amount|Localise(it_IT)}}  {{Account.Currency}}{{/Invoice}}
12.430,64 EUR Localized per locale Italian - ITALY. Currency is European.

{{Invoice.Account.Currency|Symbol}}  {{Invoice.Amount|Localise(fr_FR)}}  {{Invoice.Account.Currency}}


Or

 {{#Invoice}}{{Account.Currency|Symbol}} {{Amount|Localise(fr_FR)}}  {{Account.Currency}}{{/Invoice}}

€1.234.567,89 EUR Localized per locale French - FRANCE. Currency is European.
{{#Wp_Eval}}{{ChargeAmount}} + {{TaxAmount}}}|Round(2)|Localise{{/Wp_Eval}} 1.234.567,89

When the number is calculated in HTML templates (A + B), you can format the calculation result.

Localized per locale French - FRANCE. Currency is European.