This is the create/edit/view screen for Email and System Email Templates. These are used to fill the subject and content of emails. Both have the same fields and the only difference between the two is that System Email Templates are not available as templates on the Email Write screen.  Both are available as email templates on Document Templates. See here for more background.

 

The fields are as follows:

Name The template name
Description The template description
Subject Type

Determines how the Subject is processed. One of:

  • Plain text - the Subject is inserted into the email subject as plain text
  • Macro - the Subject is evaluated as a macro, and the result inserted into the email subject
  • Expression -  the Subject is evaluated as an xpath expression, and the result inserted into the email subject
Subject The subject to evaluate
Subject Source

An optional expression to select the object to evaluate against. This is only applicable when the Subject Type is Macro or Expression.

E.g. a value of:

$customer

would evaluate Subject against the current customer.

Content Type

Determines how the Content is processed. One of:

  • Plain text - the Content is inserted into the email as plain text
  • Macro - the Content is evaluated as a macro, and the result inserted into the email
  • Expression - the Content is evaluated as an xpath expression, and the result inserted into the email
  • Document - the content is a document. See below.
Content The content to evaluate
Content Source

An optional expression to select the object to evaluate the Content against. This is only applicable when the Subject Type is Macro, Expression or Document.

E.g. a value of:

$patient

would evaluate Content against the current patient.

Active determines if the template is active or inactive. If it is inactive it is not available for selection.

Source Expressions

The Source Expressions can be any expression or variable that sets the object to evaluate the content against.  This can be:

  • a macro variable , ie $customer, $patient, etc
  • a period (.) meaning the current document. This is most useful when creating cover-notes for use when emailing documents via the Print|Email operation.
  • left blank. For pre-filled emails, the invoice or document etc will be passed. In this case, it is equivalent to using a period.
  • an xpath expression returning an archetype object e.g. openvpms:get(., 'patient.entity')

Documents

When the Content Type is Document the following document types are supported:

  • JasperReport (.jrxml), OpenOffice (.odt), Microsoft Word (.doc)
    • The object returned by the Content Source expression will be supplied to the document to support merging.
    • When selected by the email Template option, any parameters will be prompted for.

If the Content Source expression doesn't return a valid object, the document will be converted to HTML without merging.

  • Rich Text Format (.rtf)
    No merging is supported.
  • HTML (.html)
    No merging is supported.
Syndicate content