Javascript to send storyline 360 scores to LMS

Oct 08, 2019

Does anyone know of the javascript needed to send scores from a test to the LMS?  I have seen many articles but can't find the answer. I need to pass the score and completion status.  Thank you.

5 Replies
Todd Haynes

Here's a script that worked for me (last tested 2018).

//get player and variable
var player = GetPlayer();
var score= player.GetVar("Score01")
//get LMS API
var lmsAPI = parent;
//set score; the first number is the score
lmsAPI.SetScore(Score01, 100, 0);
//set status; possible values: "completed","incomplete", "failed", "passed"
if(Score01>80)
SetStatus("completed")
Vijay Paturkar

Below script works perfectly:

Here, I am translating the points accumulated in the user variable "TotalScore". Below JavaScript is inserted in the "Results" slide in Articulate Storyline. Remove the default Submit results trigger, and then insert below JavaScript.

--------------------------------------------------------------

var myscore = 0;
var player = GetPlayer();
var ptScore = player.GetVar("TotalScore");
var maxPoints = 330;
myscore = 100*ptScore/maxPoints;

SCORM2004_SetScore(myscore, 100, 10);
SCORM2004_CommitData();

--------------------------------------------------------------

 

This discussion is closed. You can start a new discussion or contact Articulate Support.