In general, templates contain variables that are replaced with Process Data. They can be used in the message body and for generating attachments.
Correspondence templates may leverage process data or document meta-data from the model for data substitution. IN data mappings are created for each data element to be used as a data source in correspondence tags. The in data mapping ID is specified as the data source for correspondence tags. These tags are substituted with the corresponding data value immediately when the template is placed into the correspondence canvas or by clicking outside the canvas once they are typed in the editor directly.
If the value of variables cannot be found, they are displayed in the canvas so that the user can provide it.
In the following example, a correspondence process has a process data path with Id ApplicantName for a data Applicant Name.

Figure: Data Path example for a correspondence process
To reference the data value, you can use the placeholder $ApplicantName in your template.
<p>Dear <strong>$ApplicantName</strong>,</p>
If a value was entered for data Applicant Name, this value will be substituted in the resulting correspondence.

Figure: Data Path variable substituted with data value
You can use user data from user properties and extended user properties in a template, which will be substituted with the according values if the data can be found. In that case you have to provide a user as data path.
The following user attributes are supported:
The following example demonstrates how user attributes are replaced with user data:

Dear $user.firstName $user.lastName, Your account has been created with below details - Account : $user.account Realm : $user.realm Email : $user.email Valid From : $user.validFrom Valid To : $user.validTo Description : $user.description ID : $user.id Name : $user.name OID : $user.oid Quality Assurance Probability: $user.qualityAssuranceProbability Your grants: $user.allGrants Welcome on board!!! --- Team ABC


If you want to hide variables that are empty, use !, for example
$!user.description.
To include images, you can enter the following in the Source view of the content editor:
<img src="data:image/jpeg;base64,$base64Encoder.encodeBase64String($dms.retrieveContent('/documents/correspondence-templates/subfolder/image file'))"/>
For example, suppose an image logo.png is uploaded to a subfolder
logos in the correspondence-templates folder.

Figure: Uploaded image
To reference this image from a template, use:
<img src="data:image/jpeg;base64,$base64Encoder.encodeBase64String($dms.retrieveContent('/documents/correspondence-templates/logos/logo.png'))"/>
You can also use images located in any other repository folder. Suppose an image
banner.jpg is uploaded to a subfolder
blue/images in the artifacts/skins folder.

Figure: Uploaded image in skin folder
To reference this image from a template, use:
<img src="data:image/jpeg;base64,$base64Encoder.encodeBase64String($dms.retrieveContent('/artifacts/skins/blue/images/banner.jpg'))"/>
To include the user signature image in your template, enter the following:
<img src="data:image/jpeg;base64,$base64Encoder.encodeBase64String($user.signature)"/>
This references the image saved for your signature. You can add a signature to your user account in the Configuration view. Please refer to section Using a Signature in chapter Viewing and Editing your User Profile for details.
For example, add the following text in the Source view of your message content editor:
<p>Sincerely,</p> <p><img src="data:image/jpeg;base64,$base64Encoder.encodeBase64String($user.signature)"/></p> <p>($user.firstName $user.lastName)</p>

Figure: Enter signature reference in the message content editor
Once you click the Source button, the image with your signature is displayed in the editor.

Figure: Signature displayed in editor
In DOCX templates, you can create image bookmarks, which you can replace with images from the document repository.
In the following example DOCX template a bookmark named CompanyLogo is linked to an image placeholder.

Figure: Viewing an image bookmark in a DOCX document
To use a DOCX template with an image bookmark in a Correspondence UI Mashup, use a Script application to replace the image with an image from the document repository.
The following example Script code uses either a specific image or an image, which is dynamically replaced by Process Data if this data is defined:
CORRESPONDENCE_OUT = {FieldMetaData: []};
/* Push the "FieldMetaData" array elements. Individual properties:
- Type: Metadata field type. Should always equal "image"
- Name: Word Docx Bookmark Name
- Location: Document Repository image path (prefixed with repository://)
- UseImageSize: Boolean indicating if original image size should be resized
*/
// Example adding a static image bookmark
CORRESPONDENCE_OUT.FieldMetaData.push({
Type : "image",
Name : "OtherLogo",
Location : "repository:///documents/correspondence-templates/logos/sungard.png",
UseImageSize : true
});
// Example adding a dynamic image bookmark based on "CompanyId" Process Data
if (CompanyId) {
CORRESPONDENCE_OUT.FieldMetaData.push({
Type : "image",
Name : "CompanyLogo",
Location : "repository:///documents/correspondence-templates/logos/" + CompanyId + ".png",
UseImageSize : true
});
In case the in-parameter CompanyId is empty, a static image bookmark
with location
"repository:///documents/correspondence-templates/logos/sungard.png"
is pushed to the meta data.
In that case an image sungard.png has to be uploaded to the
correspondence-templates folder in a subfolder logos.

Figure: Uploaded default image
If CompanyId has a value, this value is used
for a dynamic image bookmark. The location is created dynamically with the provided
CompanyId data value as
"repository:///documents/correspondence-templates/logos/" + CompanyId + ".png".
For example, if you enter the value XYZ for data
CompanyId, an image named XYZ.png needs to be uploaded
to the correspondence-templates folder in a subfolder logos.

Figure: Uploaded dynamic image
Please see the detailed example in chapter Creating Correspondence with Templates and Image Substitution in our Tutorials Creating Correspondence with Templates and Image Substitution in our Tutorials section.