ON THIS PAGE
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Intro to Dynamic Expressions

Dynamic Expressions enable you to create personalized and data-driven content in your workspace. By combining data variables, custom translations, and formulas, you can make your content more dynamic and tailored to your audience.

For example, you can display a personalized message by typing:

"Welcome back, {{ sessionUser.name }}!"

This pulls the user's name directly into the message.

To allow our system to populate the data and to make them visually different from other content Dynamic Expressions are always enclosed in double curly braces: {{ ... }}.

Writing Your First Dynamic Expression

  1. Navigate to a text field where expressions are allowed (e.g., an Idea Collection question).
  2. Type { to bring up a list of available variables and functions.
  3. Select a suggestion or write your own expression.
  4. Add operators and functions as needed.
  5. Click away to see your dynamic expression in action.

Many text fields will immediately calculate and display the result of evaluating all dynamic expressions within them, relative to you and your own data, after they become unfocused. Check to see if you get the result you expect. And don’t worry, you haven’t lost anything you wrote - if you click on the text field again, you will see your dynamic expressions appear again, and can continue editing them.

Dynamic Expression Types

Dynamic Expressions are made up of different components that work together to display personalized or calculated results.

Data Variables

Data Variables represent data specific to your workspace, such as user names, idea counts, or form values.

  • Example: {{sessionUser.name}} might display as "John Doe."

Custom Translation Variables

Custom Translation Variables are customizable localization keys that you can create and use across your platform to display your content across languages. When used, based on the language the visiting user has set in their profile, they will display the content in the userøs language if you have defined a translation for that language.

  • Example: {{translate:custom.greeting}} displays a localized version of your greeting text.

Functions

Functions perform actions like transforming data or performing calculations. In the list they will show a signature of what arguments to pass to them, as well as their expected data types. For example, the UPPERCASE() function expects to receive text. Following that, they will show a description of what the function does, as well as an example of how you can use it.

  • Example: {{ UPPERCASE(sessionUser.name) }} converts a user’s name to uppercase.

Operators

Operators are used for calculations and comparisons.

  • Arithmetic: +, -, *, /
  • Logical: && (AND), || (OR)
  • Comparison: ==, !=, >, <
  • Conditional: ?
  • Example: {{ sessionUser.stats.likes > 10 ? "Top Contributor" : "Newbie" }} displays "Top Contributor" if likes exceed 10, otherwise "Newbie."

Literals

Literals or "raw values", such as numbers, text, or booleans can also be freely used inside Dynamic Expression as well.

  • Example: {{ 5 }} or {{ "Hello, world!" }} or {{ true }}

Error Handling

Because Dynamic Expressions are quite flexible and give you a lot of freedom, they can also easily break, and sometimes not in ways you might anticipate. For example, you may end up:

  • Dividing a number by zero.
  • Forget a closing parenthesis somewhere in your expression.
  • Reference a non-existing (or deleted) custom translation variable.
  • Mistakenly attempt to uppercase non-text, like a number.

Thankfully, should you end up in situations like these, dynamic expressions that could not be calculated correctly are easily recognizable, and will show you exactly where and what the problem was, when you hover over them.

Here are some things to consider as you’re writing dynamic expressions to reduce the likelihood of running into errors:

  • Make sure to count the number of parentheses you’re using, especially when you’re combining multiple functions
  • When you perform division, and especially when the divisor is based on a data variable, make sure to consider the cases when the divisor may be zero. You can use the MAX() function to make sure the value never goes below 1. For example, ensure a minimum of 1 like: {{ 2 / MAX(sessionUser.stats.likes, 1) }}.

Make sure to double-check the expected types of arguments to the functions you’re using, as well as the order in which they expect them.

For example, {{ UPPERCASE(2) }} will fail, since UPPERCASE() expected text, but was given a number.

Simple Examples of Dynamic Expressions

  • Simple Calculation: {{ 2 + 3 }} displays 5.
  • Personalized Message: Hello {{sessionUser.name }} displays a custom greeting.
  • Conditional Display: {{ ideaCollection.stats.ideas.total > 50 ? "We've reached our goal!" : "Needs more ideas!" }} adapts based on idea engagement.

By combining these components, you can create powerful, personalized experiences for your workspace users.

How helpful was this article?
Thank you! Your feedback helps us improve.
Oops! Something went wrong while submitting the form.