Skip to content

PermissionSet WSB_DMT_USER

A permission set that grants the user only restricted permissions (N.B. for rendering mail templates).

Properties

Name Value
Access Public
Assignable 1
Caption Apportunix Doc Mail Templ User
IncludedPermissionSets #e55908d707414ffdab4210ad0fa3f028#WSB_DCR_USER

Codeunit WSB_DMTMailTemplateRenderer

Renders Document Mail Templates (.dmt) by resolving the Handlebars-style placeholders in the stored HTML against a report XML dataset. Supported syntax:

  • {{DataItemName.ColumnName}} - inserts the (HTML-encoded) value of a report column.

  • {{{DataItemName.ColumnName}}} - inserts the value of a report column without HTML-encoding it. BLOB, Media and MediaSet columns are Base64-decoded as UTF-8 text when schema metadata is available.

  • {{#image DataItemName.ColumnName}} - inserts binary image data as an embedded PNG data URL; no closing tag is required. A Column node with a "decimalformatter" XML attribute is reformatted to that many decimal places, e.g. 968,5 is rendered as "968,50".

  • {{#each DataItemName}} ... {{/each}} - repeats the enclosed block for every record of a data item.

  • {{#if ColumnName}} ... {{else}} ... {{/if}} - conditionally includes one of the enclosed blocks.

  • {{#if ColumnName > 0}} ... {{/if}} - compares a column with a literal using =, != (or <>), >, >=, < or <=. Equality and inequality support decimal and text values; ordering comparisons require decimals.

  • {{#if !ColumnName}} ... {{/if}} - a leading ! negates the condition, including a comparison.

  • ... - repeats the element (e.g., a table row) for every record of a data item. Put it on a to repeat a group of rows, e.g. a line row followed by a row.

  • ...
    - only includes the element when the condition is true. It supports the same conditions as {{#if}}, e.g. data-if="!{{ColumnName}}" or data-if="{{ColumnName}} > 0". Both attributes can be combined on one element, in which case data-if is evaluated for every record.

  • {{! comment }} - a comment that is not included in the rendered output.

  • {{../ColumnName}} - resolves the placeholder against the data item that encloses the current one.

  • {{@index}}, {{@number}}, {{@count}}, {{@first}}, {{@last}} - the position of the current record within a repeat block.

  • {{#label Tag}} - inserts the Document Creator translation of a tag in the language of the document.

  • {{$Group.Field}} - inserts a system variable from the BCReportInformation section of the dataset, for example {{$ReportMetadata.ReportName}} or {{$ReportRequest.CompanyName}}. Nested fields such as DateTimeValues are addressed with additional path segments, for example {{$ReportRequest.DateTimeValues.Year}}. Placeholders are resolved against the current record only. Only from the root of the dataset is the whole dataset searched, so that a placeholder such as {{Line.Description}} also works outside a repeat block. A data item is looked up at the nearest nesting level below the current record, so that intermediate data items, e.g. a copy loop between a header and its lines, can be omitted: {{#each Line}} inside {{#each Header}}. A {{Column}} that the current record does not have is taken from the nearest enclosing record that has it, e.g. a header caption inside {{#each CopyLoop}}. A block must be closed by a tag of the same kind, i.e., {{#each}} by {{/each}} and {{#if}} by {{/if}}. Tags that are not closed correctly are left in the rendered output, so that the mistake is visible.

Properties

Name Value
Access Public

Methods

wgFncRenderTemplate

Renders a mail template for a report and writes the resulting HTML email body to a stream.

Parameters

Type Name Description
Record "Report Layout List" pRecReportLayoutList The mail template to render.
Text pXmlParameters A string of request page parameters as XML to use to run the report.
Variant pRecordVariant Specifies which record to use in the report.
OutStream vOutStreamHtml The OutStream that the HTML email body is written to.

wgFncRenderTemplate

Renders a mail template against the XML dataset of a report.

Parameters

Type Name Description
Text pTemplate The mail template contents (HTML with placeholders).
Codeunit "Temp Blob" pCduTempBlobXmlDataset The Temp Blob containing the XML dataset.

Returns

Type Description
Text The rendered HTML.

wgFncRenderTemplate

Renders a template with schema metadata for decoding binary text columns.

Parameters

Type Name Description
Text pTemplate The template text.
Codeunit "Temp Blob" pCduTempBlobXmlDataset The XML dataset.
Text pWordXmlPart The customized Word XML part containing column data types.

Returns

Type Description
Text The rendered template.

wgFncGetDatasetLanguageTag

Resolves language from the first non-empty data item attribute, then the root, then the session.