Community

Allow 'IF' statements on Merge Fields in Communication Triggers


Completed

Comments

2 comments

  • Avatar
    Doug Innes

    plus one

    0
    Comment actions Permalink
  • Avatar
    Adam

    The communication templates use a python based engine called Jinja.

    You can do some complex arguments within including IF statements.  Here's one such example which varies the content based on the number of active students registered to the event:

    {% set glob={"delegate_sum":0} %}

    {% for student in delegate.event.active_students %}{% set _ = glob.update({"delegate_sum": glob.delegate_sum + student.delegates_num | string | int }) %}

    {% set delegate_sum = glob.delegate_sum %}

    {% if delegate_sum >= 5 %}

    There are >= 5 students. The delegate_sum = {{ delegate_sum }}

    {% elif delegate_sum >= 3 %}

    There are >= 3, but less than 5 students. The delegate_sum = {{ delegate_sum }}

    {% else %}

    There are < 3 students. The delegate_sum = {{ delegate_sum }}

    {% endif %}

     

    The 'elif' function should be what you're looking for here.

    0
    Comment actions Permalink

Please sign in to leave a comment.