Javascript That Works - Throwing Errors & Failing?

Jun 14, 2021

Hi all, 

I have a course I've published to SCORM on our LMS. 

There are various scripts that run in the course, from printing to generating a date to social sharing to a custom data collection tool that we had developed for this express purpose. 

It's a big course, and everything works properly when exporting separate scenes as SCORM packages. 

However, the second we publish the full course with all scenes in a single package, it starts throwing errors whenever any script runs, specifically:

actionator::exeJavaScript - this.execUserJs is not a function

In short, all custom JS works when published in on scene & fails in this exact way when published all together, whether it's more complicated or very simple. 

Any thoughts?

4 Replies
Brian Dennis

My guess is the javascript scoping and dependencies are mixed up, with multiple instances of global variables. You are welcome to PM if you can provide the published .zip file so I can take a crack at the embedded javascript. For the record, "actionator" isn't a standard javascript object, so you are using some element of custom javascript already

Math Notermans

As Brian states...its probably scope related. All triggers in Storyline have their own scope. Being all variables and functions in it only work on that particular slide. So if you call function A from another slide without taking care of that...by either creating global variables to pass values or by adding the functions to a more global spot from where they are overall reachable...well then your scripts will fail and a message like above will be shown.

Using the console ( CTRL+SHIFT+I or F12 ) when testing you can figure out what function is out of scope and fix it. If all functions and scripts are out of scope... you best copy all out of your triggers, create some general script thats on the index page...and in the triggers only call the function.

Gladly help... but do need the Story for that.. i guess its not just a single function out of scope but a lot.

Trevor LaForce

Brian and Math - thanks for your insight!

So I tracked down the cause with the help of a develop we worked with & Articulate support. 

It turns out that if any custom JavaScript in the project has an error, all custom JavaScript will break. There was an instance of one script (in a minor part of the course I hadn't published independently to test) that contained an error, so everything broke. 

Lesson learned - everything has to work properly for anything to work properly. 

Math Notermans

Javascript errors tend to mess up projects easily. Debug and test continuously. A single typo can mess up everything...   A javascript error not perse needs to make your complete course not working... depends somewhat on the type of error. If a variable mismatches and its not used in critical processes the course may run normally with only returning null or undefined for that variable. If in your code returning null or undefined is managed properly eg. an if statement or case switch that makes sure the code wont stop and sets the variable to a default... then  your projects flow will be uninterrupted.