Update the value of discounts in communication

If you offer your customers a discount with a fixed value in response to their actions, you can use an expression as a variable in the templates of your messages (email, SMS, mobile push, web push) and other types of communication (dynamic content on websites) to display the discount value.

The main advantage of this solution is quick modification of the value of discount - when you modify the expression, its result is automatically updated in all templates the expression is used.

Read more


If you want to explore the subject of expressions and their usage, read the following articles:

Create an expression


In this part of the process, you create an expression with a discount value, which will be used as a variable in the template of the message further in the process.


  1. Go to Analytics > Expressions > New expression.
  2. Enter the name of the expression.
  3. Leave the Expression for option at default (Attribute).
  4. Build the formula of the expression.
    1. Click Select.
    2. From the dropdown list, select Constant.
    3. Click the field that appeared on the dashboard.
    4. Enter the value of discount.
      Formula of the expression
      Formula of the expression
  5. Click Save.

Use the expression insert in templates


In this part of the process, you use the expression as a variable in the message template.

  1. Go to Communication and select the type of message.
  2. Go to the code editor.
  3. On the upper right side of the screen, click + Inserts.
    Selecting the expression on the list of inserts
    Selecting the expression on the list of inserts
  4. From the dropdown list, select Expressions.
  5. Find the expression you created in the first part of the process.
  6. Click the name of the expression.
  7. Copy the Jinjava code of the expression.
  8. Paste it in the template.
  9. Style the template according to your preferences.
Preview of the template that contains the expression variable
Preview of the template that contains the expression variable

Modify the expression


If you need to change the value of the discount, edit the expression you created in the beginning of the process. As a result, the expression will return the new value in all templates in which the expression is used as a variable.

To edit the expression:

  1. Go to Analytics > Expressions.
  2. Find the expression on the list.
  3. Click the expression.
  4. Make the changes to the formula of the expression.
  5. Click Publish.
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker