Template

Sets a property based on the provided template.

Inputs

  • msg (object) : A msg object containing information to populate the template.

  • template (string) : A template to be populated from msg.payload. If not configured in the edit panel, this can be set as a property of msg.

Outputs

  • msg (object) : a msg with a property set by populating the configured template with properties from the incoming msg.

Details

By default this uses the mustachearrow-up-right format, but this can be switched off if required.

For example, when a template of:

receives a message containing:

The resulting property will be:

It is possible to use a property from the flow context or global context. Just use {{flow.name}} or {{global.name}}, or for persistable store store use {{flow[store].name}} or {{global[store].name}}.

**Note: **By default, mustache will escape any non-alphanumeric or HTML entities in the values it substitutes. To prevent this, use {{{triple}}} braces.

Last updated