Penstock

Guide / Draw and edit

Scripts in their own tab

Edit a script from a task as a real file in your tool's own code editor, with its colours, completion and checks.

Free Camunda 7, Operaton and CIB seven

Why

The small editor in the properties panel is fine for one line. For a longer script you want a full code editor. Penstock hands the script to your tool as a file and writes every keystroke back into the diagram.

Steps

  1. Select a script task, or any element that holds a script: a condition, an input or output mapping, an execution listener or a task listener.
  2. In the properties panel, find the script field. Under it is a button Edit in new tab. Press it.
  3. A code editor opens with the script as a file: .groovy for Groovy or .js for JavaScript.
  4. Type. Your changes go back into the diagram about 100 milliseconds after each keystroke, and reach the diagram model 400 milliseconds after you stop.
  5. Close the editor when you are done.

In your tool

JetBrains

The IDE opens a new editor tab. Because the file has the extension .groovy or .js, the IDE's own colours, completion and inspections apply. Pressing the button again brings the existing tab to the front.

VS Code

VS Code opens a new editor tab beside the diagram, whose extension is that of the script's language, such as .groovy or .js. Pressing the button again brings the existing tab to the front. Closing the tab brings the text back to the property. The tab is not a file on disk and cannot be renamed.

Command line

Not available on the command line. The command line has no editor. Edit the script in the diagram file, or with penstock edit.

What you see

The default language

Set scriptType in penstock.yaml to groovy, javascript or none. It is used for a script that has no format yet, and for a condition expression that has no language yet. It applies to Camunda 7, Operaton and CIB seven only. See penstock.yaml.

Common problems

There is no Edit in new tab button.
The button exists for Camunda 7, Operaton and CIB seven. In Camunda 8 a script is a FEEL expression and is edited in the panel.
The code is coloured as the wrong language.
The script format is JavaScript or Groovy as set on the element. Change the script format in the panel and open the script again.
I closed the script and lost text.
You did not lose it. Everything you typed was already written back into the diagram. Undo in the diagram if you need an older version.