Bitrix24Care

Modify symbolic codes in document templates

Document templates contain symbolic codes that are used instead of different data.

For example, {DocumentCreateTime} code that you use in a document template gets replaced by actual document creation time in a document print form.

You can modify symbolic codes in document templates to use different data formats according to your needs.


How it works

Add specific symbols after the tilde (~) to symbolic code to change the data format.

Read more about editing documents templates in the article - Document templates.

You can modify symbolic codes for the following data types:

Also, symbolic code modifications allow you to:


Date and time

By default, the date format in a document template is the same as the country that this document template belongs to. Here is how to modify the symbolic code that is used for adding document creation time to a document print form:

{DocumentCreateTime~Y-m-d g:i:s a}

Here is how the print form looks now:

Possible date and time formats

  • d.m.y – 30.08.18
  • d.m.Y – 30.08.2018
  • j, n, Y – 30, 8, 2018
  • H:i:s – 15:07:06
  • Y-m-d g:i:s a – 2018-08-30 3:07:06 pm
  • F j, Y, G:i – August 30, 2018 15:07
You can read more about possible date and time formats in the article.

Name

You can modify the name format by adding specific words to symbolic codes.

Name format parameters

  • #TITLE# - salutation
  • #NAME# - first name
  • #LAST_NAME# - last name
  • #SECOND_NAME# - second name
  • #NAME_SHORT# - the first letter of the first name
  • #LAST_NAME_SHORT# - the first letter of the last name
  • #SECOND_NAME_SHORT# - the first letter of the second name

For example, the symbolic code {FormattedName~Format=#TITLE# #NAME# #SECOND_NAME_SHORT# #LAST_NAME#} will be replaced by salutation, first name, the first letter of the second name and last name in the print form.


Address

By default, the address format in a document template is the same as the address format used in the country that this document template belongs to. But we can modify the address symbolic code and use, for example, North American address format despite the fact that the document template is bound to the UK:

{Address~Format=3,Separator=3}

Address formats and separators

The Format part of symbolic code defines the address format type:

  • 1 - Europe
  • 2 - UK
  • 3 - North America
  • 4 - Russia (Street-->Country)
  • 5 - Russia (Country-->Street)

The Separator part of symbolic code defines the type of separator used in the address in the print form:

  • 1 - comma
  • 2 - no separator
  • 3 - line break

Here is how the document print form will look like after the address symbolic code modification:

{Address} symbolic code is getting replaced by the address specified in the Street Address field of company details.

Money amounts

For money amounts, you can modify symbolic code so that zeros after dot and currency will be shown in a print form of a document.

Money amounts parameters

  • WZ (With zeros) - if you select Y value, zeros after dot are shown. For example, 12.00 instead of 12.
  • NS (No sign) - if you select N value, currency sign is added. If you select Y value, currency sign is not shown.

For example, let's modify the {TotalSum} symbolic code so that zeros after dot will be shown, and currency sign will be added:

{TotalSum~WZ=Y,NS=N}

Here is how the document print form will look like:


Phone number

You can specify the phone number format by adding a specific symbolic code after format. For example:

{ClientPhone~format=E.164}

Here is how the document print form will look like:

Available phone number formats

  • E.164 – +12122191234
  • International – +1 212 219-12-34
  • National – 1 (212) 219-12-34

Listing all products, contacts or taxes from the list

For example, you have three different products in a deal.

You can list all the products in the document. Just add all=y to the corresponding symbolic code:

{ProductsProductName~all=y}

Instead of a comma, you can use a line break as a separator by adding mseparator=2 to the symbolic code:

{ProductsProductName~mseparator=2,all=y}

Here is how the list of these products will look like in the print form:


A specific product, tax or contact from the list

Some data is added to the document as a list. For example, taxes, products or contacts.

Read how to add a list to a document in the article - Document templates.

You can add to a document a specific item from the list. Just use the symbolic code:

{ProductsProductName}

By default, the first item from the list will be added to the document.

If you need to add an item that is not first in the list, just add index to this symbolic code. For example, this symbolic code will add the third item:

{ProductsProductName~index=2}
The first item in the list has index=0.

Multiple fields

In Bitrix24 CRM, fields can be marked as multiple. That means that this field can have multiple values at the same time. For example, Phone, Email, Messenger fields or any custom field marked as multiple.

Documents templates don't support Bind To CRM Elements and File types of multiple fields.

Use the symbolic code mfirst to add multiple field values to the document:

  • mfirst=y - add the first value
  • mfirst=n - add all the values

For example:

{Phone~mfirst=n}

By default, values are separated by a comma. Use the symbolic code mseparator to select a separator - comma (1) or line break (2):

{Email~mfirst=n,mseparator=2}

Here is how the document print form will look like when using these codes:


Text case

This modifier is available starting from documentgenerator 22.200.0 version.

One of the frequent requests is a modifier to change the text case.

Now you can add the letterCase modifier to any field to change the text case.

The modifier can take the following values:

  • upper — upper case,
  • lower — lower case,
  • title — upper case for the first letter of each word.

The ~all=y, modifier will output all values of the multiple "Binding to CRM elements"field.


Recommended articles:
Was this information helpful?
Integration specialist assistance
That's not what I'm looking for
Complicated and incomprehensible text
The information is outdated
It's too short. I need more information
I don't like the way this tool works
Go to Bitrix24
Don't have an account? Create for free
Related articles
Add an image, stamp, or signature to your document template Documents in CRM: Access permissions Create and upload your document template to CRM Documents in CRM Edit document templates in CRM Custom fields in document templates Sorting templates in the list Document templates for different countries Rules for product fields in CRM documents Document templates for different countries