Setting SCORM status in Articulate Storyline 360

Aug 21, 2017

I've gone through several threads here on sending SCORM Status and Score to the LSM via JavaScript. Here's a nice write up.  There are other discussions as well. Overall, they all come down to this code:

var lmsAPI = parent;
lmsAPI.SetScore(100, 100, 0);
//set status; possible values: "completed","incomplete", "failed", "passed"
SetStatus("completed");

For some reason, the moment I try to use SetStatus, it throws an error. I'm not using SCORM 2004, so it should work. But for me in SL 360 in ScormCloud it just won't work. The score setting is fine.

For those who may run into this, this was my workaround: I have a JS variable, totalPerf, which is a number betwen 0 and 1, as percent of performance. I wanted to send the score as %, and the set the status as completed if it's larger or equal to 70, and incomplete if it's smaller. 

var lmsAPI = parent;
lmsAPI.SetScore(Math.round(totalPerf*100),100,0);

if (totalPerf>=0.7)
{

// Sends completed status.
lmsAPI.SetReachedEnd();
}
else
{

lmsAPI.ResetStatus();
}

This may or may not work in yours but it's worth a try.

6 Replies
James Reid

Thanks for this Zsolt.  I am very interested in any kind of additional reporting to ScormCloud via javascript and your notes in various places have been a great help to me. Although I understand it is not supported by Articulate, and liable to change, it is very useful. Anyone else with insights, please chime in? I am using SL3update2, publishing HTML5, SCORM2004 4thd ed, hosting in ScormCloud. I found changes since SL2: (1) lmsAPI=parent no longer works for me. lmsApi=[object Window] seems to work. (2) lmsAPI.SetStatus seems to not exist any more in this context? I will try your workaround, using SetCompleted, SetPassed and ResetStatus which seem to still exist. Question: you imply limitations with SCORM2004. Where can I find more info on this? What publish format are you using for ScormCloud? Thanks.

Bastiaan Timmer

Maybe this is also helpful. We created two Javascript scripts for sending the completion state to the LMS. We based our code on the SCORM2004functions.js and SCORMfunctions.js files:

SCORM 1.2:

//get LMS API
var lmsAPI = parent;
//set score; the first number is the score
lmsAPI.SetScore(90, 100, 0);
//set status; possible values: "completed","incomplete", "failed", "passed"
SCORM_CallLMSSetValue("cmi.core.lesson_status", "complete");

SCORM 2004:

//get LMS API
var lmsAPI = parent;
//set score; the first number is the score
lmsAPI.SetScore(90, 100, 0);
//set status; possible values: "completed","incomplete", "failed", "passed"
SCORM2004_CallSetValue("cmi.completion_status", "completed");
SCORM2004_CallSetValue("cmi.success_status", "passed");

I've tested both script on SCORM Cloud and they are working as expected.

Ako HKOWVE


Hi Bastiaan, thanks for this help.
Could you tell me how to change the status of the failed course?

I have a variable called "Score" that has been increased according to the correct answers, if this variable is less than 80 it changes the status of the failed course, if it is higher than 80, it changes the state to competed.

Thank you

Bastiaan Timmer

Hi,

It then mainly depends on which LMS has been used. Often a module with a "failed" status can no longer be modified. The module is closed by the LMS.

In such cases it is better to only send a status if the user has succeeded. If they have failed due to a lower score, you do not send anything to the LMS.

 

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