External resource problem

See Freemarker Script: Greater than 4000 char, exceeding historic variable instance DB insert

And you can pass the execution object into your freemarker engine as a binding. This is the same way that Camunda does it when using a script task and you can use the “freemarker” as your script type.

If you use JavaScript, you can use the nashorn load("http://....") to load your file and then pass it into the freemarker engine.