Elements are building the blocks of every document and sheet. They allow Maven Documents users to turn a simple textual document into a rich, content-filled document.
You can insert elements in DOCX, XLSX, Google Docs, and Google Sheets documents. Depending on the document type, different elements can be inserted.
The purpose of elements in Maven Documents is to keep the flexibility of standard document generation, while also incorporating data from the Salesforce database.
In Salesforce, users define the dynamic data they want inside an element. In the document, users design and define how the element will end up visually along with static data that does not change from document to document.
Elements are designed to contain both dynamic and static data needed for Salesforce's record-specific document creation.
Here is the list naming every single one of them, along with some information and platform availability:
Element Name | Maven Documents Reference | Description | Availability |
---|---|---|---|
Repeater |
mdoc:repeater |
Iterates throgh the defined records. Returns the content of a collection according to the specified structure. |
DOCX, XLSX, Google Docs, Google Sheets |
Table |
mdoc:table |
Iterates through the defined records. Repeats the row for each defined record. |
DOCX, Google Docs |
Paragraph |
mdoc:paragraph |
Shows/hides the Document's section. |
DOCX, Google Docs |
Image |
mdoc:image |
Renders an image from a URL or base64 data type. |
DOCX, XLSX, Google Docs, Google Sheets |
Rich Text |
mdoc:richText |
Adds data from the corresponding "Rich Text Area" field on Salesforce. |
DOCX, Google Docs |
Code |
mdoc:code |
Renders different types of codes (QR codes, Barcodes, etc.). |
DOCX, XLSX, Google Docs, Google Sheets |
Page Break |
mdoc:pageBreak |
Inserts a page break in the document. |
Google Docs, DOCX files |
Text |
mdoc:text |
Shows/hides the inline part of the text. |
DOCX, Google Docs. |
Link |
mdoc:link |
Renders a hyperlink from a URL. |
DOCX, Google Docs, DOCX. |
Table Row |
mdoc:tableRow |
Hides rows based on criteria. |
DOCX, Google Docs. |
Table Column |
mdoc:tableColumn |
Hides columns based on criteria. |
DOCX, Google Docs. |
Include |
mdoc:include name |
Inserts elements or another document's content into the template. |
DOCX, XLSX, Google Docs. |
Row |
mdoc:row |
Removes/collapses a row with the element. |
XLSX |
Column |
mdoc:column |
Removes/collapses a column with the element. |
XLSX |
Sheet |
mdoc:sheet name |
Removes a sheet with the element. |
XLSX |
To find more about a specific element, check out reference pages for different document types:
Along with variables unique to every element, the following quialities are common to every element:
selfClosing
. Represents whether an element is closed immediately, as opposed to standard HTML tags, which have both an opening and closing tag.displayType
. Represents whether an element is displayed in the "inline" or "block" type.containers
. Shows where an element can be present inside the document: header, footer, and/or body.There are also basic parameters that every element has:
Parameter Name | Type | Description | Required | Default Value | Expression |
---|---|---|---|---|---|
name | string | Name of the element. | true | - | false |
hidden | boolean | Determines whether the element is visible. | false | false | true |
The Expression column indicates whether an Expression can be used as the parameter's value.
Elements are written in the HTML-like code directly in the template document. They naturally mix in with text to create a visually pleasing and logical result. For example, the "Table" element:
And its result:
The data that appears in the "Table" and "Repeater" elements is dynamic and linked to the record for which the document is being generated.
All the element definitions have some commonalities and standards. Here's the general form of an element:
Every element definition starts with opening angle brackets "<" and ends with closing angle brackets ">"
Inside the brackets, the first thing is Maven Documents Reference, e.g. "mmdoc:repeater".
If the element is self-closing, the first thing is the forward slash "/" symbol.
After the reference, you can define general and specific parameters. Those parameters can be either static or dynamic:
If the element isn't self-closing, the closing tag must exist.
The closing tag follows the form of the opening tag but starts with the forward slash "/" inside the brackets and contains only the element's name.
The "Table" element is a great example of how small code can achieve great results. It allows to generate a great number of different tables and documents:
The first line of code is the opening tag of Table.
By default, the table is set to repeat rows defined until its closing tag.
General information about the element can be figured out from the definition:
The number of content repeating inside the table is defined by the number of records retrieved from the "Value" parameter: the "OpportunityLineItems" field on the "Opportunity" Object. A single "OpportunityLineItem" iteration is defined with the variable named "oli". The "repeatingRow" is set to 1.
Those rows are only repeated once in the beginning and at the end of the table as they are defined before and after the repeating row.
As the "repeatingRow" is set to 1, only the first row of the table repeats. It exchanges the dynamic variables for the respective values from Salesforce.
For more information about table parameters, check out the reference pages for the "Table" element.
The closing tag of Table contains the forward slash "/", Maven Documents Reference, and the name of the element.