Set and Get LMS Variables

Feb 24, 2014

Hi,

I want to save a variable in the LMS that contains an action of the student.

Then, when the course starts again it have to validate this variable to make an operation different depending on the content of this variable.

I´ve been searching for an answer in the forum, but nobody talks about LMS variables 

3 Replies
Brian Caudill

There are 2 objects available in JavaScript that only work in the SCORM HTML5 export. 
lmsAPI and lmsAPI.objLMS

If you type the following into the JavaScript Trigger you will get a list og methods available for the objects printed into the browser console. (If you are not familiar with the console you can Google "how to access the browser console" and it will show you how to use it) 
console.log(lmsAPI)
console.log(lmsAPI.objLMS)

As an example:
You can set a scorm objective score using:
lmsAPI.objLMS.SetObjectiveScore('policy_quiz', score_variable, '100', '0');

You can set the status of a SCO using:
lmsAPI.SetStatus('completed');

You can set data from suspend_data using
var player = GetPlayer();
var score1 = parseInt(player.SetVar("my_variable","my_value"));


You can get data from suspend_data using
var player = GetPlayer();
var score1 = parseInt(player.GetVar("my_variable"));

 

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