Forum Discussion

SunilDhakad's avatar
SunilDhakad
Community Member
12 days ago

ExecuteScript its not working after reload/refresh in trigger.js

Hi,

We have recently upgrade the storyline latest version (Build 3.92.33293.0) and we seems some changes in javascript. Earlier we had only user.js file to each slide script calling for jump on other slides. but after upgrade we can see the ExecuteScript moved to seperate file which is trigger.js file to execute the script on case basis. we noticed that trigger.js file having ExecuteScript calling only once while we cached clear and page reload but second time we just reload page its doesn't calling ExecuteScript from trigger.js file. 

we have added alert into ExecuteScript function it gives prompt on first time only. Can you please look into it and provide the solutions?

  • SusanDiana's avatar
    SusanDiana
    Community Member

    I think the issue because the latest version runs your script inside another function. Which means your variables and functions are scoped to only be available inside that function. A solution to work around this is to create/assign them in the window scope. So something like this:

    window.myFunction = function(){
    // ... your function
    }

     

  • As Susan says this might be due to scope. In the past each Storyline trigger got its own scope. So trigger A was unaware of anything defined in trigger B. I didnot explore the new way Articulate publishes in depth to say anything bold, but im inclined to think Susan is correct. Do search my posts for 'scope' or 'global scope' and you will find some workarounds for the old way of publishing. Susans apprach migt be the best fit for it now.