Script in file for Script Task

Hello, is it possible to use script in file for script task?

According to the documentation - it is not possible - BPMN 2.0 Constructs · Flowable Open Source Documentation

But it is possible in Camunda - Scripting |

Maybe I miss something and it is possible in flowable.

You can get there in a round-about way. JavaScript secure scripting.

Hey @maratkalibek,

We currently do not provide a way to use a file for the script task.

If you are writing code then I would suggest looking into implementing your own JavaDelegate instead of using a Script in a file.


Let me explain how we are using Flowable.

We are using Flowable only with user tasks, external worker jobs, events and script tasks. Flowable Engine stays as separate service consumed by REST api. Process definitions being deployed via REST endpoint. We are trying to keep Flowable service as simple as possible and without any specific java libraries. Since complied java code cannot be loaded dynamically (uploaded via rest with process definition - bar archive), we mostly use scripts. But scripts can be relatively long which is not very convenient to use. So providing “long” scripts with files will be more likely for us.

So except script file for the task there will be also issue how to provide this resource to process instance context.

As a workaround we can implement JavaDelegate which loads and executes groovy scripts.

Thanks for reply. :fist:

We use script files. You need a version of java that still supports nashorn.
Then set the script task language to Javascript.
Then use load() to load scripts from disk.
You have to deploy the script files the server.

We don’t use the method anymore. Instead we save the scripts to the DB and load them using an sql query.