Stop copying the same details by hand. Templates in OfficeRnD Flex use dynamic data placeholders to fill names, dates, prices, and more. With tokens that pull data, logic tags that show or hide sections, and filters that format text, numbers, and lists, your documents stay consistent.
This article will help you use tokens, logic tags, and filters to build and test templates.
Summary
Templates in OfficeRnD Flex support tokens that pull live data into your documents and emails.
You can add logic tags (if, for) to show or repeat parts of a template only when needed.
Filters let you format data, transform text, and work with lists and numbers.
You can use these tools across invoices, contracts, member emails, and other system templates.
This article explains how templating works, outlines the available functions, and includes examples that you can reuse.
Before you start
You need admin access to the Templates section in the Admin Portal.
Each template supports different tokens depending on its type (e.g., invoice tokens vs. contract tokens). These are listed in the dedicated articles for each template.
Some filters and tags are common across all templates, which are explained below.
What are templates?
Templates let you create documents and emails that pull live data using dynamic data placeholders. Instead of hardcoding details like a member's name or an invoice amount, you insert tokens such as {{ member.name }}
or {{ totalAmount | money }}
. When Flex generates the document or email, it replaces each placeholder with the real value.
You can also add simple logic and lists, allowing a single template to adapt to different cases. For example, show a location-specific message with an if
tag, or list invoice lines with a for
tag:
{% if location.name == "Sofia" %} Welcome to our Sofia space! {% endif %} {% for line in lines %} {{ line.description }}: {{ line.amount | money }} {% endfor %}
When and why to use tokens and filters?
Personalize documents: Add member names, company details, or contract start dates automatically.
Automate calculations: Sum totals, format numbers as currency, or count items in a list.
Conditional logic: Show or hide text depending on location, membership type, or other data.
Lists and iterations: Loop through invoice line items, contract clauses, or order details.
Example: A coworking space in Berlin uses filters to show invoices with totals in euros, while a partner in London applies percent
filters to show VAT clearly.
What can you achieve with filters and logic?
With filters and tokens, you can:
Insert member, company, and resource details automatically.
Format text (capitalize, uppercase, lowercase, replace).
Work with lists (sort, group, find items, sum values).
Format numbers and money correctly.
Display dates in the right format.
Add optional or repeating sections with
if
andfor
logic.
Logic tags
IF
To add optional template parts, you can use the if
tag. It must be wrapped in {% and %} and closed with {% endif %}.
If you'd like to show a message when a document is being generated for a specific location, you can do it like this:
{% if location.name == "Sofia" %}
Welcome to our Sofia space!
{% endif %}
FOR
To repeat the same part of the template multiple times, you can use the for
tag. Inside it, you can refer to the item for the current iteration.
{% for orderLine in order %}
<div>
Price: {{ orderLine.price|money }}
</div>
{% endfor %}
You can also refer to loop.first
and loop.last
to check if you are in the first or last iteration:
{% for orderLine in order %}
<div>
Price: {{ orderLine.price|money }}
</div>
{% if !loop.last %}
<div>-----------------------</div>
{% endif %}
{% endfor %}
Filters and functions
Even though most of the values we pass to the templates are already formatted, you may want to do something differently. To provide you with this opportunity, we offer a series of built-in filters. Those are special formatting functions that can be used as part of the token by appending the filter name with a vertical bar (|).
Text filters
capitalize
– Upper-case the first letter, lower-case the rest.title
– Capitalize the first letter of every word.lower
– Make all text lowercase.upper
– Make all text uppercase.replace
– Replace part of a string with another.
List filters
first
– Return the first item in a list.last
– Return the last item in a list.reverse
– Reverse the order of items.sort
– Sort items in an ascending direction. If given an object, it will return the keys as a sorted array. If given a string, each character will be sorted individually.uniq
– Remove duplicates.length
– Count items in a list.groupBy
– Group items by a field.join
– Combine list items into a single string.sum("field")
– Return the sum of all values in a list by field. Can optionally receive a selector/field - the field to sum by, or a function to use to transform elements before summing them up (likeparseMoney
).map("field")
– Return a projection of a list by field or selector. Enter a parameter that is a field name or a selector function to use to transform each element.find("field", "value")
– Find the first occurrence of a value in a list. Enter two parameters: the field to compare with the expected value.filter("field", "value")
– Find all occurrences of a value in a list. Enter two parameters: the field to compare with the expected value.
Numbers
money
– Format numbers as money.percent
– Format numbers as percentages.parseMoney(value)
– Function (not a filter). Parses a raw value into money.
Other
date
– Format dates.default
– Provide a fallback value if the token is empty.json
– Convert values into JSON.
Examples
Total: {{ totalAmount | money }}
Total sum: {{ lines | sum("amount") }}
Deposit amount: {{ (lines | find("account", "672f1975ebb8be0cfdcc7fd0")).amount | money }}
Deposit lines count: {{ lines | filter("account", "672f1975ebb8be0cfdcc7fd0") | length }}
FAQs
Which tokens can I use in each template?
Each template type (e.g., contract, invoice, email) has its own set of tokens. Check the dedicated article for the template you are editing.
Can I test my template before using it?
Yes. You can preview templates in the Admin Portal. Always test with real data to ensure tokens and filters display correctly.
What happens if a token is empty?
You can use the default
filter to provide fallback text. Example:
{{ member.phone | default("No phone number provided") }}
Can I combine multiple filters?
Yes. Example:
{{ member.name | upper | replace(" ", "_") }}
What are the most common use cases for logic tags?
if
: Adding location-based messages.for
: Listing invoice lines, booking details, or charges.