LinkScript
Introduction
A LinkScript is a named, reusable Groovy script that can be chained with other LinkScripts to build composable processing pipelines. Each LinkScript exposes a body of Groovy code and a set of arcs that wire its result into (or out of) other LinkScripts. This lets you decompose a complex computation into small, independently testable scripts and connect them into a dependency graph instead of duplicating logic across many tasks, actions, and listeners.
LinkScripts are evaluated by name through LinkScriptService.run(name, bindings) and are cached for reuse, so the same script can be invoked from many places with different input bindings.
Access
Navigate to: Studio > LinkScript.
The menu entry (studio-link-script) is available under the Studio application root.
The grid lists existing LinkScripts. Each row provides a Test button (play icon) to run the script directly from the list.
Creating a LinkScript
A LinkScript is defined by the following fields:
| Field | Required | Description |
|---|---|---|
Name |
Yes |
Unique name used to invoke the LinkScript. It is the identifier under which the script is registered and called by |
Transactional |
No |
When enabled (boolean switch), the LinkScript execution runs inside a transaction. Defaults to |
Description |
No |
Free-text HTML description of the script’s purpose. |
Body |
Yes |
The Groovy script body (see Body). |
Body
The Body tab holds the Groovy code, edited in a syntax-highlighted code editor.
|
If you do not add a |
Arcs
LinkScripts are connected to one another through arcs. Each arc points from one LinkScript to another and carries an optional condition. Two arc collections are available on the form, each shown as a related grid:
-
Dependency arcs — LinkScripts that must be evaluated before this one. Their results are made available as bindings in this script’s body.
-
Output arcs — LinkScripts that consume this script’s result.
Each arc row has the following fields:
| Field | Description |
|---|---|
Name |
The binding name under which the target LinkScript’s result is injected. Must match the pattern |
Condition |
An optional Groovy condition. When present, the arc is only followed if the condition evaluates to |
To LinkScript |
The target LinkScript the arc points to. A new LinkScript can be created inline from this field. |
Arcs are ordered by Sequence and can be reordered in the grid.
Testing a LinkScript
Click the Test button (in the grid or the form toolbar) to open the test popup.
In the popup you provide the bindings the script expects as a list of parameter/expression pairs:
-
The Parameter is the binding name used inside the script body.
-
The Expression is evaluated as a Groovy expression if it starts with
eval:; otherwise it is treated as a plain string.
The bindings the script can accept are detected automatically from the body when the popup opens (via LinkScriptController.setBindings()), so the parameter rows are pre-populated with the script’s dynamic variables.
Click Test in the popup to run the LinkScript. The result is returned and displayed as an info message.
Technical Details
Entities
| Field | Type | Description |
|---|---|---|
|
String (required, unique) |
Invocation name of the LinkScript |
|
Boolean (default: false) |
Whether the script runs within a transaction |
|
Large String |
HTML description |
|
Large String (required) |
The Groovy script body |
|
O2M: LinkScriptArc |
Arcs whose |
|
O2M: LinkScriptArc |
Arcs whose |
The LinkScriptArc entity holds sequence, name, conditionScript, and a required toLinkScript (target). LinkScriptBinding is a non-persistable helper entity (parameter / expression) used by the test popup.
Backend Services
-
LinkScriptService— Entry point;run(name, bindings)resolves the LinkScript by name and evaluates it, returning aLinkScriptResult. -
LinkScriptServiceImpl— Core evaluation logic, including arc traversal and binding injection. -
LinkScriptBindingsService/LinkScriptBindingsServiceImpl— Build the binding set passed to the script. -
LinkScriptGroovyEvaluator/LinkScriptEvaluator— Evaluate the Groovy body;LinkScriptGroovyScriptHelperanalyzes the script to detect dynamic variables. -
LinkScriptCacheLoader— Caches compiled LinkScripts for reuse. -
LinkScriptController— Form actions:setBindings()(detect bindings for the test popup) andrun()(execute and report the result).
The package root is com.axelor.studio.ls.
Related Pages
-
Builders Introduction — Scripting context and Groovy helpers
-
App BPM Configuration — Custom variables and BPM scripting
-
BPM Overview — Complete BPM feature overview