OL Learn

External Library wont refresh

Hi, I’m using a datamapper met 8 external JS Libraries through a workflow process.

Everything works fine until the the external JS Libraries get updates, the workflow uses a temp file of the old libraries instead of the updated new ones. When I open the datamapper I see a * after the filenames of the JS files, indicated they are not the updated versions.

How can I fix this. I need the workflow to process with the updated version of the external JS.

That’s how it was designed: the data’s consistency and stability could be jeopardized by an updated version of a JS library. This is less of a concern for Templates because a minor change to the resulting document’s look is usually acceptable, but a minor change to how the data is extracted could have disastrous effects.

is there any workaround?

Well there is a way… but it is neither elegant nor safe:…

WARNING: use at your own risk!
As the first step in your DataMapping config, add a JavaScript Action Step.
Use code like the following to load and activate one (or more) libraries dynamically:

var libFile = openTextReader('C:/Libs/MyLibrary.js', 'UTF-8');
var libContents = "";
var oneLine="";
while((oneLine = libFile.readLine())!=null){

libContents += oneLine+"\n";


WARNING: Make sure you are in control of the code in the JavaScript library! The last line in the above sample code blindly executes the JS file, so if someone injects some malicious code in that file, results could be disastrous.

1 Like

yes I control the code of the js library.
Thank you for the response, i’m going to try this.

Do I still need to include my external js library in the external library tab?

No need to include it in the list since you load it dynamically from inside your script.

1 Like

Thank you! I’m gonna try this out

Thanks Phil this is exactly what I was looking for works great!

Many kudos