Introduction to DREL

This topic describes what Data Reference Expression Language (DRELClosed Data Reference Expression Language (DREL) is used to get form data and metadata and add it to a string, such as dates, usernames, or answers to questions in forms.) is, and how to use it correctly to reference information from Form Submissions.

Available on all tiers:

Essentials
Advanced
Enterprise

Contents

What is DREL?

Data Reference Expression Language (DREL) is a TrueContext proprietary language used to reference information about Form Submissions. With DREL, you can build expressions that include form metadata and question answers.

You can use DREL to

  • customize the name of form submissions in the mobile app and in the Web Portal
  • customize the name of folders and document files in data destinations such as cloud services or emails
  • include variable content in emails for customers
  • set up filtering rules for data destinations, and
  • map data and metadata to records within data destinations such as ServiceMax or Salesforce.

How to use DREL

DREL expressions use a combination of references, properties, and static text. The following image shows an example of an expression using DREL.

Form Submitted by %u[name] displays the user's name and last name.

  • References are variables that define the information in the expression. They always have a “%” symbol followed by a letter. Some references have a default property.

    Example: %u references the last user who submitted a form. This information might be the User ID, Username, or Email, depending on the property. %u without a property returns the user’s Display Name (first and last name and username).

  • Properties specify the information to return for the reference. Place them in brackets [ ] after a reference when you want the system to return a property other than the default, or when the reference doesn't have a default property. Some references can include more than one property.

    Example: [name] specifies that the user information returned is the user's first and last name, as configured in their user profile. In the example, %u[name] returns John Doe.

  • Static text provides additional information. The system returns static text as is.

    Example: Form Submitted by adds context to the expression and is returned as a text string in the example.

Info:You can test your DREL expression on data from a previous form submission or dispatch.

You can use any number of references to create an expression. The following image shows an expression that includes the Form Submission Properties reference (%r), the User reference (%u), and the Date reference (%d), along with some static text.

Form # 20121212-1812345 Submitted by John Doe on 2020-09-14

Info:The topic DREL Complete Reference List provides a full list of references and properties.

Escape special characters and line breaks

When you use DREL expressions in text documents such as JSON or XML, remember to add the escape property at the end of the expression. Use the following syntax: [#escapedocumentFormat]

To escape the data referenced by all DREL expressions in a document, include an expression with the following syntax at the beginning of the document: #c[escapeDocumentFormat]

where DocumentFormat is either Json, Xml, Html, Csv, or Url.

To override the global escape, include the following property as part of a DREL expression: [#escapeNone]

When you use the escape property or the global escape expression, the system displays special characters and line breaks in the document format you specify.

Info:The topic Escape Special Characters and Line Breaks for Template-driven Text Documents includes greater detail and more examples of how to use the DREL escape property.

Related topics