Skip to content

Add to Templating Engine Docs: InputParameter inline-scripts using templating engines fail to resolve when starting with ${ or #{ #168

Description

@user170200

I believe this behavior is rather curious, than an actual bug - Which is why I think the documentation should mention it

A simple example of an activity with input mappings below:

  • working = all is fine
  • failing = fails, because UEL does not do freemarker magic and fails to resolve '${ict}'
  • workaround = prepend with a comment so 'isExpression' evaluates to false
<bpmn:sendTask id="Act1" name="doesn't matter">
  <bpmn:extensionElements>
    <camunda:inputOutput>
      <camunda:inputParameter name="working">
        <camunda:script scriptFormat="freemarker">Hello ${name}, I heard you like:
&lt;#list icecreamtypes as ict&gt;
  * ${ict}
&lt;/#list&gt;
      </camunda:inputParameter>
      <camunda:inputParameter name="failing">
        <camunda:script scriptFormat="freemarker">${name} likes:
&lt;#list icecreamtypes as ict&gt;
  * ${ict}
&lt;/#list&gt;
      </camunda:inputParameter>
      <camunda:inputParameter name="workaround">
        <camunda:script scriptFormat="freemarker">&lt;#-- leading comment prevents Operaton from treating this as a dynamic script-source expression (see StringUtil.isExpression) --&gt;${name} likes:
&lt;#list icecreamtypes as ict&gt;
  * ${ict}
&lt;/#list&gt;
      </camunda:inputParameter>
    </camunda:inputOutput>
  </bpmn:extensionElements>
</bpmn:sendTask>

The reason is, that the input value is checked to be a dynamicExpression:
https://github.com/operaton/operaton/blob/main/engine/src/main/java/org/operaton/bpm/engine/impl/util/ScriptUtil.java#L195,
which calls:
https://github.com/operaton/operaton/blob/b272acfa5c6486e4a0e0b2ef89a692a64b65c423/commons/utils/src/main/java/org/operaton/commons/utils/StringUtil.java#L36


Suggestion:

  • Add to Templating Engine Docs, that starting a template expression with ${ or #{ leads to misinterpretation, which can be fixed by adding a comment or starting with a different character sequence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions