Feature request: Ability to add remote scripts

I would like to have the option to use remote scripts.

The reason for this is that we have a lot of different templates that all share similar code in one way or another. For example I have a global script that contains functions that are used within all the other scripts. From time to time I come across a document that I am building that needs an additional global function. As I would like to have certain scripts the same for all the document templates I now have to go through all the other templates and copy + paste this code across all of them to keep them all the same.
For a few templates this is annoying but doable. When you have 60+ templates this becomes a very irritating task.
Also it would be great to have this to keep the templates even smaller (of course this will have an impact when loading the template as it will need to load in all the external resource).

As there are already a lot of possibilities to add remote files. E.g.:

  • Resources: Stylesheets, Java Scripts, Images, Snippets, Translations, etc.
  • Within scripts: you can use loadHTML or loadJSON to load snippets

Almost the only thing that does not have a remote option are the scripts itself.

We tried placing all the document templates within a single template so we can share the code among all the templates but after a while there are serious performance issues.
And of course this also brings other downsides like hard to manage changes as one change for a document can have a major impact for another document.

Hello dvdmeer,

This is on our backlog (internal ref: SHARED-87605). While it hasn’t been given high priority at this time, I understand your point. I will discuss this with our development team to assess its impact.

Currently, the only way to make the process somewhat easier is by using the Import option: File > Import > Connect resources. This feature allows you to import various resources from, for example, a central template, although it remains a manual process.

Erik

@dvdmeer I briefly discussed this with my colleague @Sander. One way to solve this today would be using eval() (although we are not a big fan of that approach).

We ran a few tests by putting a file on a webserver and called that in a Control Script like this.

eval(loadtext("http://localhost:1880/test.js"))

Or from the file system like this:

eval(loadtext("C:/workspace/test.js"))

It appears to get the job done, but employing eval() might come across as somewhat unconventional, so proceed with caution and use at your own risk

Erik

1 Like

Thank you for this. For now I will leave it as is then and I will have to update each template separately whenever I make changes to the global scripts.

Hello, any update on the subject?

I might have rushed the creation of new topic ([Solved] How to implement a Designer global external function? - Designer - Upland OL User community), while eval load text can suffice for a single script is there any other workaround to load a whole folder of scripts?

Furthermore this applies only to the template, can’t find anything similar for the datamapper.