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:
<#list icecreamtypes as ict>
* ${ict}
</#list>
</camunda:inputParameter>
<camunda:inputParameter name="failing">
<camunda:script scriptFormat="freemarker">${name} likes:
<#list icecreamtypes as ict>
* ${ict}
</#list>
</camunda:inputParameter>
<camunda:inputParameter name="workaround">
<camunda:script scriptFormat="freemarker"><#-- leading comment prevents Operaton from treating this as a dynamic script-source expression (see StringUtil.isExpression) -->${name} likes:
<#list icecreamtypes as ict>
* ${ict}
</#list>
</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.
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:
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:
${or#{leads to misinterpretation, which can be fixed by adding a comment or starting with a different character sequence.