How to access quiz results from external JavaScript

I spent some time gathering info on this subject, and although there seems to be a lot written on the topic, none of the pages I read put it all together. This really is way simpler than people imagine.

Within Storyline, create a user variable NUMBER type called usrScorePoints - the data type must match the Results. For example, you can't set a usrScorePoints TEXT variable to the Results.ScorePoints. You can create a new user var for each of the scores/percents - all of which are NUMBER variables.

usrScorePercent for Results.ScorePercent
usrScorePoints for Results.ScorePoints
usrPassPercent for Results.PassPercent
usrPassPoints for Results.PassPoints

Create a trigger on the Results slide, and set the Action to Adjust variable usrScorePoints = Results.ScorePoints system var when Timeline starts. Do this for all the user vars.

Access the user vars in Javascript by using:

var player=GetPlayer();
var usrScorePoints=player.GetVar("usrScorePoints");
alert(usrScorePoints);

I created a custom Completion Certification that uses usrName and the pass/fail data to generate an HTML certificate as well as an encrypted code that includes the date, name, and score - I can use that to validate a learner's score in a CBT. I could just as well write a script to update an LMS if I needed to.

 

5 Replies
Daniel Bolia

Hello Kenneth,

Thank you for taking time to outline the procedures for passing quiz results via JS. Could you post/share an example storyline file and accompanying html file or a published storyline file that demonstrates how you created the completion certificate. you mentioned in your post.

Thank you! 

Ali Al-Shufafa