Menu

composeContent

Evaluates the content commands in the defined document part or an external document. A Flow does not automatically evaluate logic in the template's document content, so this command must be used in order to produce dynamic document content.

The template attribute defines the document content to evaluate. There are three types of valid resolved values for this attribute:

  • A DAP Part causes the content of that Document or Email part to be evaluated. Use the Document Properties variable doc to get the Part you need. For example: ${doc["Body Content"]}  
  • A String value can be used in Online templates. The value should be a path pointing to a HTML document within the template's archive - this is the document whose content is evaluated. For example: "Cover Page/content.html"
  • A File value. The file may be an HTML or a legacy Office template, whose content is then evaluated. 
  • An undefined value can be used in legacy Office templates. It causes the content of the template itself to be evaluated. Note that running this command more than once in this way is not recommended, as after the first run the command attempts to evaluate the already evaluated content, which generally does nothing.            

The result of the evaluation will be a File value. The name of the file in the case of Online templates' HTML documents will be the title of the document. For legacy Office templates the name will simply be the name of the template file.

To evaluate content of Word, PowerPoint and Excel templates containing Word, PowerPoint or Excel content commands, use the composeDOCXContent, composePPTXContent and composeXLSXContent commands instead.

Child commands

  • evaluateTag
    Optional. Add one or more of these to limit the commands that are evaluated. 

Attributes

var

Required
Value type
EL-evaluated
No String
No
Defines the name of the variable placed into the variable context whose value is the evaluated document, which is a File - either an OOXML document or a HTML document depending on what the evaluated template is.

This attribute does not need to be defined if this command is evaluated in an Office template and the template attribute is undefined.
template

Required Value type EL-evaluated
No
DAP Part, File, String
Yes
Defines the template whose body content is evaluated. The resolved value may be a DAP Part, a String or a File, as described in this command's documentation.

This attribute does not need to be defined if this command is evaluated in an Office template.
importResult

Required
Value type
EL-evaluated
No
Boolean
Yes
This attribute can be used to control what a content HTML logic attribute produces when the Online template this command is in is imported through it. If this attribute's value resolves into true, then the product of this command will appear instead of the product of some other composeContent command in the same Flow.

This attribute has no effect when used in Office templates.
editable

Required
Value type
EL-evaluated
No
Boolean
Yes
If this attribute resolves into false, any HTML content commands that are capable of making their contents editable will not do so, regardless of their own attribute values. This may also affect other behavior of HTML content commands, which will then be mentioned in their documentation.

The resolved value of this attribute is available to all the evaluated content commands with the variable name "composeContent_editable".

This attribute has no effect when used in Office templates.
displayEmptyValues

Required
Value type
EL-evaluated
No
Boolean
Yes
If this attribute resolves into true, the HTML content commands content and model will output empty String values if their primary attributes resolve into such. Normally they treat an empty String as a undefined value and will not affect their host element in any way.  

This attribute has no effect when used in Office templates.
inlineStyles

Required
Value type
EL-evaluated
No
Boolean
Yes
If this attribute resolves into true, the CSS properties applying to each element in a composed HTML document are written into their "style" attributes. This "inlining" of the styles makes the HTML more suitable to be used as email content, but will increase the size of the file and in certain cases also cause appearance-changing style interactions.

If not defined, value of false is used.  

Examples

The composeContent command is a fairly common sight in Flows and often used in this basic way to produce composed document content.

<composeContent var="composed" template="doc['Document']">

Should you have a need to produce multiple versions of a document within the Flow, it can be done without much complications by using composeContent several times while switching the data rendered in the document between the composings. This is a fairly necessary thing to do if your Flow contains a Screen in which the user can edit the document - the document has to of course be composed before the Screen, and but also after it to recreate the composed document File so that it has the user-made changes in it.  

Here's an example of producing a Collection of composed documents with a loop of record IDs:

<setCollection var="composedDocs">
<forEach value="${productIDs}" var="productID">
  <record var="product" type="Product2" recordID="${productID}" fields="Name, ProductCode">
  <composeContent var="composed" template="doc['Product Sheet']">
  <addItem value="${composed}" collection="${composedDocs}">

If this Flow is part of a template that exists to provide content to import into another template's body with the HTML logic attribute content, the importResult attribute can be useful. If this Flow has multiple result documents produced by composeContent, only one of them can be imported and this attribute defines which. Just ensure its value resolves to a Boolean true for the result you wish to import.

<composeContent var="notImported" template="doc['Blank Document']" importResult="${false}">
<composeContent var="imported" template="doc['Special Document']" importResult="${true}">  

Comments

0 comments