When generating the content of individual messages, you can use a wide range of built-in Boldem functions. Besides basic data operations (conditions, loops, arithmetic operations,
formatting, etc.), the templating system can also retrieve other needed data, such as product information or RSS feeds.
Template functions
Loading products
loadProducts <list>
Description: returns a list of products based on your external product ID.
Arguments: list – array of external product IDs.
Return value: array of ProductFeedItemModel elements ProductFeedItemModel
Usage:
{{ items = loadProducts [1,2,3,4] }}Loading products by filter
loadProductsWithFilter dataSourceId filter topLimit
Description: returns a list of products matching the specified filter.
Arguments:
- dataSourceId – ID of the data source (e.g., Heuréka XML feed)
- filter – limit output by a specified filter; you can restrict data by category name, price, etc.
- topLimit – limit on the number of products returned, default value 10.
Return value: array of ProductFeedItemModel elements ProductFeedItemModel
Usage:
{{ items = loadProductsWithFilter 20 '{category}~{ct}~{Kuchyně}~and~{price}~{qt}~{5000}' 15}}
or for use with data from customFields
{{ items = loadProductsWithFilter 20 '{customFields.customField1}~{eq}~{Kuchyně}' 1}}Load product by ID
loadProduct productExternalId
Description: returns the product using your external product ID.
Arguments:
- productExternalId – external product ID
Return value: model element ProductFeedItemModel
Usage:
{{ item = loadProduct 20 }}Loading products by itemGroupIds
loadProductsByItemGroupIds dataSourceId itemGroupIds
Description: This function is intended primarily for working with products in Shoptet. Here each item has its own itemGroupId. If a product has variants, all variants of that product share the same itemGroupId. Searching by itemGroupId therefore returns one of the variants of that product.
Arguments:
- dataSourceId – ID of the data source (e.g., Heuréka XML feed, Shoptet integration, etc.)
- itemGroupIds – list of itemGroupIds for searched items.
Return value: array of elements of the ProductFeedItemModel model
Usage:
{{
itemGroupIds = []
for itemGroupId in orderProduct.accessoryIds
itemGroupIds = array.add itemGroupIds itemGroupId
end
productWithRelatedItems.relatedProducts = loadProductsByItemGroupIds 1022 itemGroupIds
}}Loading articles from an RSS feed
loadRssFeed url topLimit
Description: retrieves a list of articles from the specified URL.
Arguments:
- url – URL of a valid RSS feed
- topLimit – limit on the number of products returned, default value 10.
Return value: array of elements of the model RssFeedItemModel
Usage:
{{ items = loadRssFeed 'https://boldem.cz/feed/' 20 }}Remove special characters from text
remove diacritics from text
Description: the function removes special characters from the given text.
Arguments:
- text – input text
Return value: text without special characters
Usage:
{{ removeDiacritics 'Příliš žluťoučký pes úpěl ďábelské ódy' }}
Output: Prilis zlutoucky pes upel dabelske odyDeclension of first and last names
vocative name
Description: returns the vocative form of the given first or last name.
Arguments:
- name – first or last name for declension.
Return value: first name or last name in the vocative case.
Usage:
{{ vocative 'Jaroslav' }}
Output: JaroslaveFormat number as currency
formatNumber format cultureInfo
Description: returns the formatted number as an amount in the specified currency.
Arguments:
- format – how to format the number.
- cultureInfo – language or culture code
Return value: formatted amount.
Usage:
{{10000 | formatNumber 'C0' 'cs-CZ'}}
Output: 10,000 CZKFinalizing file URL
resolveFileUrl filePath
Description: Adds the full URL to a file’s relative path (obtained from the gallery), based on the selected domain router in the campaign/transactional template.
Arguments:
- filePath – relative path to a file in the file gallery
Return value: the full resulting URL including the domain router
Usage:
{{ resolveFileUrl '/files/800800/8dfe6292-493e-4a76-8bd0-d19dfa0cb1a7/velikonoce_boldem.png' }}
Output: https://mails.boldem.cz/files/800800/8dfe6292-493e-4a76-8bd0-d19dfa0cb1a7/velikonoce_boldem.pngCheck for content at the specified URL
isResponseSuccess URL
Description: checks whether content is present at the specified URL.
Arguments:
- url – URL address of the requested web content
Return value: true/false
Usage:
{{ isResponseSuccess 'https://mails.boldem.cz/files/800800/8dfe6292-493e-4a76-8bd0-d19dfa0cb1a7/velikonoce_boldem.png' }}
Output: trueExport data model as JSON
Print JSON data
Description: the function outputs the specified data model as text, serialized as JSON.
Arguments:
- data – data model, e.g. RssFeedItemModel
Return value: text
Usage:
{{
mojeData = { "cisloProdejny" : 1 }
printJson mojeData
}}
Output: { \"cisloProdejny\" : 1 }Loading order
Load Order Order ID
Description: the function returns data about an order created on your online store by its ID.
Arguments:
- orderId – order ID in Boldem
Return value: model element OrderModel
Usage:
{{ orderData = loadOrder 1547 }}Load order by external ID
loadOrderByExternalId orderExternalId
Description: the function returns data about an order created in your online store based on the provided ID.
Arguments:
- orderExternalId – Order ID from your online store
Return value: model element OrderModel
Usage:
{{ orderData = loadOrderByExternalId 1547 }}Loading shopping cart contents
loadCart cartId
Description: This function returns data about a created shopping cart (an incomplete order) on your online store.
Arguments:
- cartId – shopping cart ID in Boldem
Return value: model element CartModel
Usage:
{{ cartData = loadCart 458 }} Loading custom web event content
loadCustomWebEvent customWebEventId
Description: The function returns data about a created custom event on your website, e.g., a form submission.
Arguments:
- customWebEventId – ID of a custom web event in Boldem
Return value: model element CustomWebEventModel
Usage:
{{ customWebEventData = loadCustomWebEvent 458 }}QR Code Generation
generateQrFromRaw grText
Description: the function generates a QR code that can contain, for example, payment order information (also returns the image URL), e.g., payment for an order.
Arguments:
- grText – contains the text used for generation, e.g., various information required for the payment order.
Return value: the domain router returns the QR code URL.
Usage:
{{ qrText = 'SPD*1.0*ACC:' + global.company.ibanBankAccount + '*AM:'+order.priceWithVat+'*CC:'
+order.currencyCode+'*MSG:ORDER '+order.code+'*X-VS:'+order.code}}
{{ qrText }}
{{generateQrFromRaw qrText }}
Načtení dat o pobočce Zásilkovny
getPacketaData branchId lng
Popis: funkce vrací informace o výdejním místě nebo boxu Zásilkovny. V datech je obsažena adresa pobočky, otvírací doba i fotografie a popis přístupu.
Arguments:
- branchId – ID pobočky Zásilkovny
- lng – jazyk, ve kterém chceme vrátit data, je povolen pouze dvoupísmenný formát ISO 639-1, např. cs, en, sk.
Návratová hodnota: prvek modelu PacketaDataModel
Usage:
{{ branch = getPacketaData 18579 'cs' }}
Jaroslav Bouška