Setting LMS status with Javascript when using SCORM 2004, 4th edition

Hello there,

 I am using SL3 and publishing a quiz to HTML5. I don't use storyline's inbuilt result slide (due to the design) but uses the following javascript to pass the score and status to LMS at the end.

 

var player = GetPlayer();
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
lmsAPI.SetScore(player.GetVar("FinalScore"), 100, 0);

var passingScore = "80";
if (player.GetVar("FinalScore") >= passingScore)
{
lmsAPI.SCORM_CallLMSSetValue("cmi.core.lesson_status", "passed");
} else {
lmsAPI.SCORM_CallLMSSetValue("cmi.core.lesson_status", "failed");
}

 

This is working fine for SCORM 1.2

However due to 'suspended data' limit in SCORM 1.2, the quiz did not resume after a particular slide, then I need to change the output option to SCORM 2004 4th edition. Now the quiz resumes as expected.

But the completion status is not working even though the score is passed to LMS correctly. LMS status is shown as completed/passed even for 30% of the score. Reporting status to LMS is set as "Passed/ Incompleted".

How to correct the above javascript when using  SCORM 2004, 4th edition?

4 Replies
Joey Buys

Hi Fon Alejandro.

Noticed the original thread is quite old, so I thought I would attempt to assist.

In SCORM 2004 we have a few functions that we can leverage to set the Passed / Failed parameters instead of the lmsAPI.SCORM_CallLMSSetValue("cmi.core.lesson_status", "passed"); used in Sanduni's example.

Maybe try the following code and see how it behaves:

var player = GetPlayer();
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
lmsAPI.SetScore(player.GetVar("FinalScore"), 100, 0);

//Replace FinalScore with the variable you are using in your course

var passingScore = "80"; 
if (player.GetVar("FinalScore") >= passingScore)
{
lmsAPI.SetPassed();
} else {
lmsAPI.SetFailed();
}

Lawren Benoit

In SCORM 2004, cmi.completion_status (“completed”, “incomplete”, “not attempted”, “unknown”) and cmi.success_status (“passed”, “failed”, “unknown”) are two separate data elements that must both typically be updated correctly in order for your completion to be recorded.

For a pass, completion_status = completed and success_status = passed.

For a fail, completion_status = completed and success_status = failed.

Experiment with other combinations to see how your LMS reacts.