Elements are the building blocks of every document and sheet. They allow Maven Documents users to turn a simple textual document into a rich, content-filled document that can satisfy the needs of a whole range of users. Elements can be inserted in Google Docs, Google Sheets, DOCX, and XLSX documents. Depending on the type of document, different elements can be inserted.
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 |
The flexible programmatic iteration that allows nesting elements |
Google Docs, Google Sheets, DOCX files, XLSX files |
Table |
mdoc:table |
Allows programmatic iteration over a collection |
Google Docs, DOCX files |
Paragraph |
mdoc:paragraph |
Shows/hides the Document's section |
Google Docs, DOCX files |
Image |
mdoc:image |
Renders an image from a URL or base64 data type |
Google Docs, Google Sheets, DOCX files, XLSX files |
Rich Text |
mdoc:richText |
Adds data from the corresponding Rich Text Area field from Salesforce |
Google Docs, DOCX files |
Code |
mdoc:code |
Renders different types of codes (QR codes, Barcodes, etc.) |
Google Docs, Google Sheets, DOCX files, XLSX files |
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 |
Google Docs, DOCX files |
Link |
mdoc:link |
Renders a hyperlink from a URL |
Google Docs, DOCX files |
Table Row |
mdoc:tableRow |
Hides rows based on criteria |
Google Docs, DOCX files |
Table Column |
mdoc:tableColumn |
Hides columns based on criteria |
Google Docs, DOCX files |
Include |
mdoc:include |
Allows adding elements or another document's content into the template |
Google Docs, DOCX files |
Row |
mdoc:row |
Remove a row where the element is located |
XLSX file |
Column |
mdoc:column |
Remove a column where the element is located |
XLSX file |
Elements have variables that allow users to customize every part to their liking. All of them are described, listed, and available, so to find more information about a specific element, check out the reference pages for different document types. There you'll find which elements are available for different document types and how these elements work. Along with variables unique to every element, there are general specifications that every single element has:
There are also basic attributes that every element has:
Attribute Name | Type | Description | Required | Default Value | Expression |
---|---|---|---|---|---|
name | string | Name of the element. | false | - | false |
hidden | picklist | Determines if the element is visible. | false | - | true |
The Expression column indicates whether an Expression can be used as that attribute's value.
The purpose of elements in Maven Documents is to create the flexibility of standard document generation, while also incorporating data straight from the Salesforce database, all in the simplest form available. All that could be accomplished with a combination of the Salesforce platform and Google Docs, Google Sheets, DOCX, or XLSX documents. In Salesforce users define the dynamic data they want inside an element, while in a document, users design and define how the element will end up visually, along with static data which does not change from document to document. Elements are designed so they can contain both dynamic and static data needed for Salesforce's record-specific document creation.
Elements are written in the HTML-like code directly in the Document Template. They naturally mix in with text to create a visually pleasing and logical result. An example of the Table element's code is shown below:
The resulting table looks something like this:
The data that appears in the Table and Repeater elements is dynamic and linked to the record for which the document is being generated. This allows users to do a lot of work, with minimal effort.
This code may scare some users, especially non-coding ones, but the code is simple and it only takes a line or two to achieve needed results.
All element definitions have some commonalities and standards that allow a general description of what an element looks like. Therefore, the general form of an element is:
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, unless the element is self-closing in which case the first thing is the / symbol
After the reference, general and specific attributes can be defined statically or dynamically:
If the element isn't self-closing, a closing tag must exist. Everything between the opening and closing tag is contained within the element.
The closing tag follows the form of the opening tag but starts with a / inside the brackets, and has no attributes other than a name.
A table is a great example of how little code can achieve great results as it allows for very few lines of code and text to generate a great number of different tables and documents. One specific example of a table being used is:
The first line of code is the opening tag of a table. The table is set to repeat rows defined until its closing tag by default. The number of content repeats inside the table is defined by the number of records retrieved from the value attribute. In this case, OpportunityLineItems is related to an Opportunity. A single OpportunityLineItem's iteration name is defined with the attribute variable, here named "oli" Some general information about the element can be figured out from the definition:
As the repeatingRow is set to 1, only the first row of the table will repeat, exchanging the dynamic variables for intended values (for more information about table attributes, check out the reference pages for the table):
This row will only repeat once, at the end of the table because it is purposely skipped as a repeating row and defined after the row that will repeat
The closing tag of the table, containing the /, Maven Documents Reference and the name