From 811c39357ad87d18dba6facbca9af65d671e5328 Mon Sep 17 00:00:00 2001 From: pralav-25 <174412353+pralav-25@users.noreply.github.com> Date: Sun, 15 Nov 2026 23:08:00 +0530 Subject: [PATCH 1/2] docs: clarify dynamic inline script source detection --- .../user-guide/process-engine/scripting.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/documentation/user-guide/process-engine/scripting.md b/docs/documentation/user-guide/process-engine/scripting.md index fc89f27c..ab2f67bf 100644 --- a/docs/documentation/user-guide/process-engine/scripting.md +++ b/docs/documentation/user-guide/process-engine/scripting.md @@ -514,6 +514,21 @@ If you use another scripting language than Expression Language, you can also spe source as an expression which returns the source code to be executed. This way, the source code can, for example, be contained in a process variable. +:::caution[Dynamic script-source detection] + +For languages other than JUEL, Operaton treats inline script content as an expression that +resolves to source code when the content starts with `${` or `#{` after whitespace is trimmed +for detection. This applies to script tasks, listeners, conditions, and input/output parameters. +The content is evaluated as an expression before the selected script engine receives source code, +so an unintended match may cause errors or unexpected output. + +Leading whitespace does not prevent detection. If those characters belong to the script or +template itself, prefix the content with a comment recognized by that language, or load it +from an external resource. For external resources, this detection applies to the resource +path, not to the contents of the loaded file. + +::: + In the following example snippet the process engine will evaluate the expression `${sourceCode}` in the current context every time the element is executed. From 78347dd1dfce51a3fc2fecc7c2eb6d0b9dda2e47 Mon Sep 17 00:00:00 2001 From: Karsten Thoms Date: Mon, 16 Nov 2026 13:22:06 +0100 Subject: [PATCH 2/2] docs: editorial changes to script source detection - placed caution box after resource-path example, where it's cleat what it qualifies - detailed placeholder parsing for other languages - double mentionining of leading whitespace reduced to one --- .../user-guide/process-engine/scripting.md | 43 ++++++++++++------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/docs/documentation/user-guide/process-engine/scripting.md b/docs/documentation/user-guide/process-engine/scripting.md index ab2f67bf..d5412a41 100644 --- a/docs/documentation/user-guide/process-engine/scripting.md +++ b/docs/documentation/user-guide/process-engine/scripting.md @@ -514,21 +514,6 @@ If you use another scripting language than Expression Language, you can also spe source as an expression which returns the source code to be executed. This way, the source code can, for example, be contained in a process variable. -:::caution[Dynamic script-source detection] - -For languages other than JUEL, Operaton treats inline script content as an expression that -resolves to source code when the content starts with `${` or `#{` after whitespace is trimmed -for detection. This applies to script tasks, listeners, conditions, and input/output parameters. -The content is evaluated as an expression before the selected script engine receives source code, -so an unintended match may cause errors or unexpected output. - -Leading whitespace does not prevent detection. If those characters belong to the script or -template itself, prefix the content with a comment recognized by that language, or load it -from an external resource. For external resources, this detection applies to the resource -path, not to the contents of the loaded file. - -::: - In the following example snippet the process engine will evaluate the expression `${sourceCode}` in the current context every time the element is executed. @@ -546,7 +531,7 @@ the current context every time the element is executed. - ```${sourceCode} + ${sourceCode} @@ -593,6 +578,32 @@ script task. ``` +:::caution[Dynamic script-source detection] + +For languages other than JUEL, Operaton treats inline script content as an expression that +resolves to source code when the content starts with `${` or `#{`. Leading whitespace is ignored +for this check. The format name is compared case-insensitively, and a script task without a +`scriptFormat` defaults to `juel`, so no detection takes place in that case. Detection applies to +script tasks, listeners, conditions, and input/output parameters. + +Once the content matches, the whole content is parsed as a single composite expression. Every +`${...}` and `#{...}` in it is resolved by the expression language and +the remaining text is passed through literally. An unintended match can therefore: + +* replace placeholders that were meant for the script language, for example Groovy GString + interpolation such as `"${price}"`; +* fail at runtime if a referenced variable does not exist; +* fail the deployment if the content is not valid expression syntax, for example a Groovy + closure such as `${ x -> x }`. + +If the content legitimately starts with `${` or `#{`, prefix it with a comment recognized by that +language, or load it from an external resource. The comment itself must not start with `${` or +`#{`; in languages that use `#` for comments, such as Python or Ruby, write `# {...}` instead of +`#{...}`. For external resources, detection applies to the resource path, not to the contents of +the loaded file. + +::: + For more information, see the [operaton:resource](../../reference/bpmn20/custom-extensions/extension-attributes.md#resource) section of the [Custom Extensions](../../reference/bpmn20/custom-extensions/index.md) chapter.