variables in email template control structures

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hi-ko
    Member
    • May 2015
    • 90

    variables in email template control structures

    When I use email template (for BPMN send message task) I'm able to reslve variable values using syntax
    Code:
    {$$variableName}​
    but I don't get these variables to work in control structures like if or each. I tried:
    Code:
    {{#ifEqual needChanges 1}}
    {{#ifEqual $$needChanges 1}}
    {{#ifEqual [{$$needChanges}] 1}}
    ​
    using
    Code:
    {{#ifEqual {$$needChanges} 1}}
    throws:
    Code:
    Wrong variable naming as '{$$needChanges}' in {{#ifEqual {$$needChanges} 1}} ! You should wrap ! " # % & ' * + , ; < = > { | } ~ into [ ]
    with no luck. What is the correct syntax to access a variable in a template control expression?
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    As far as i know, there is no such support for variables. Condition could be applied only to entity's attributes. Maybe a feature request.
    Rabii
    Web Dev

    Comment

    • hi-ko
      Member
      • May 2015
      • 90

      #3
      That's a pitty. I'm looking for a way to send emails with the outcome of an multi instance user task which is stored as object in the process' variables.
      I created a simple array variable containing the strings I want to list in the email template but in the email template I cannot access these variables in the control structure since they seem not to be passed as input object like the parent entity.

      yuri Maybe you have an idea? Is it worth to create an enhancement request to e.g. put the process' variables as an object to the template context when executing an email message task?

      The quick & dirty work around I use for now is to convert the array into a string as html snippet in a separate script task, which I then add as {{$$variable}} in the email template

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        I'll look into when get a chance. But no guarantees, as these are in separate products, it may be not that trivial to implement.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        Working...