SCORM 1.2 course returns an empty string in Moodle
Jun 11, 2016
SCORM 1.2 course can't pass score (cmi.core.score.raw) to Moodle LMS on mobile devices only. It returns an empty string in Moodle.
I have developed a sample test file in Articulate Storyline 2 and published it as SCORM 1.2 which don't seem to trigger the right function call ( LMSSetValue cmi.core.score.raw ) in Moodle LMS.
In order to pass the score value to Moodle, i used the following JS code in a trigger on timeline start at end of course :
/*Get player to reference*/
var player = GetPlayer();
/*get LMS API*/
var lmsAPI = parent;
/*set score; the first number is the score*/
lmsAPI.SetScore(player.GetVar("14543GameScore"), 100, 0);
/*set status; possible values: "completed","incomplete", "failed", "passed"*/
if (player.GetVar("14543GameScore")>= player.GetVar("14543PassingPercentage"))
{
SetStatus("passed");
}
else
{
SetStatus("failed");
}
I published it as SCORM 1.2 course with following settings :
Report Status to LMS : Passed / Failed
Track using number of slides viewed
Include HTML5 output (for mobile devices)
After uploading it to Moodle as SCORM 1.2 package, it can't pass score value and status to Moodle on mobile devices only.
But same course passes score and status to Moodle on desktop.
So, i tested it on SCORM Cloud and Blackboard LMS to identify any issue with my course. To my surprise, it can easily pass score and status to SCORM Cloud and Balckboard on mobile devices as well as desktop.
I have tested with Moodle 2.6.5 and 3.1 with debugging and API Activity Log enabled.
I noticed in the log it can't trigger the right function call, i.e. LMSSetValue (cmi.core.score.raw, min and max) on mobile devices.
I have also attached the Articulate Storyline 2 course file (.story) , published output as SCORM 1.2 and Moodle API Activity Log.
48 Replies
Reports page from Moodle:
It can pass the status in both desktop and mobile devices. But couldn't pass the score from mobile.
in the red box above, the student has taken the test from mobile device and actually passed the test. but the score couldn't be passed to Moodle.
in the yellow box above, the student has taken the test from desktop and passed the test. the score also got passed to Moodle.
This post was removed by the author
here is the moodle site access to test the scorm file on both desktop and mobile devices:
http://homerevision.in/mod/scorm/view.php?id=1704
username : test
password : 12345678
i tested the same on SCORM Cloud.
on desktop, it's passing the status and score to SCORM Cloud
but, on mobile devices, the status and score is Unknown in SCORM Cloud.

on SCORM Cloud from Desktop:
on SCORM Cloud from Mobile:
i have noticed that when the course is launched through index_lms.html , it can pass the status and score to LMS . But when lauched through index_lms_html5.html, it can't pass the status or score. there seems to be an issue with the JS code in html5 (mobile) version.
There are lots of good reasons to use a custom JS call. I do this pretty often because it's more flexible (and sometimes more reliable) than the built-in methods. It does work consistently if the calls are configured. When using the JS call, you're calling the exact same functions that the Storyline player uses.
Here's the thing. Don't use onBWEvent();. This is only called by the Flash-based player. It works great if you're only using Flash but if you want it to work across platforms, you'll want to use SetScore();
var player = GetPlayer();
var Score = player.GetVar(“ScorePercent”)
var lmsAPI = parent;
lmsAPI.SetScore(Score, 100, 0); //second parameter is max, second is min scaled
More here:
https://community.articulate.com/discussions/articulate-storyline/basic-integration-of-scorm-api
@Ankit - i don't want to use the quiz presets of storyline because it won't allow me to build what i am looking for. i want a totally custom made quiz from blank slide. as a result storyline won't allow me slides other than storyline quizzes to their result slide.
Steve :you are a true hero. really appreciate your help.
will the above code work in Moodle LMS (2.6.5) in html5 as well as flash?
some users are accessing the course from mobile devices and some of them from desktop.
so, i need to work in both flash and html5.both on desktop and mobile.
i have to test your new code.
steve: where can i learn custom js calls? and how can i learn to configure them? especially for stroyline?
it will open up a world of possibilities for a non-coder like me.
var player = GetPlayer();
var Score = player.GetVar(“ScorePercent”)
var lmsAPI = parent;
lmsAPI.SetScore(Score, 100, 0); //second parameter is max, second is min scaled
in the above code where should i set my score variable called percent?
is there any way to pass both completion status and score to lms in scorm 1.2?
i can publish it in scorm 2004 if the above js code works in scorm 2004. will it work in scorm 2004? scorm 2004 passes score and ccompletion status at same time. so i want to use it.
You'll want to suppress Storyline's submission behavior so SL doesn't overwrite your score. It'll work in SCORM 2004 and 1.2. Should also work in Flash and HTML5.
Put your storyline score variable into the bolded spot below:
lmsAPI.SetScore(Score, 100, 0);
great.
one more important thing. i want to pass the status (passed or faile) as well in the code above like in onbw event.
i have to pass both status and score.
Add this:
SetStatus("completed"); //or passed, failed, incomplete
one last thing.
where do i add this line in code? sorry, i don't know how to add or remove lines.
can you send me code once more by adding the line for status?
also, how can i do this : "You'll want to suppress Storyline's submission behavior so SL doesn't overwrite your score." ?
and how do i learn to make this custom js calls? any resource will be appreciated.
thank you so much for your time and help.
Steve : can you please take a look at my story file (named :Mixed_MCQ_Click...) i attached in the original post (1st) ?
i replaced the old flash based js code (on bw event) with your new code above. but it seems it's creating some sort of issue with other js code maybe in the file (like the code to get student name).
whenever i'm using your new code in my story file, the other js code for example Get Student Name isn't working anymore. Moreover, it couldn't pass the score also with new code.
Is it interfering with existing js code ?
but if use my old js code (on bw event) keeping the original file unchanged, both the get student name and pass score is working fine.(name :
the Get Student Name js code is the 1st slide. and the code to pass score is on the last slide.
also, i used your new code replacing the number variable with mine called percent as follows :

var player = GetPlayer();
var percent = player.GetVar(“percent”)
var lmsAPI = parent;
lmsAPI.SetScore(percent, 100, 0); //second parameter is max, second is min scaled
though it's passing status, the score is showing unknown in SCORM Cloud. i tested it on a new file . in a blank slide.
i have attached both the original course and new test file with a blank slide.
Take the var off of the front of var lmsAPI = parent;
JUST: lmsAPI = parent;
No var.
I put that into my example. My mistake;)
ok. thanks.
and why isn't it working if i put the code in my story file? is it due to that extra var?
can you send me the code once more together with set status?
var player = GetPlayer();
var percent = player.GetVar(“percent”)
lmsAPI = parent;
lmsAPI.SetScore(percent, 100, 0);
SetStatus("completed");
//if you wanted to make sure the score was above a certain value before passing in completed
//it might look like this:
if(percent>=80){
SetStatus("completed");
}
thanks for the code
the previous code (onBW event) couldn't pass score and status neither to Moodle LMS nor to Scorm Cloud from mobile devices (both android and iOS).
now i'm facing another problem with new code (below) :
the course is passing score and status to Scorm Cloud both from desktop and mobile.
but same course when launched from Moodle (2.6.5) in mobile, can't pass score and status to LMS .it's showing score : 0 and status : incomplete . i have tested on 3 different Moodle installations. 2.6 , 2.7 .
it can however pass the status and score to LMS on desktop.
it can't pass the score and status to LMS on mobile.
i have tested all the browsers : chrome , firefox, safari. both old and recent version.
i am totally confused now.
please help me out.
i really need to solve this.
i have attached the story file . the js code is on last 2 slides. result slide.
here is the code i'm using :
var player=GetPlayer();
var score=player.GetVar("percent");
var lmsAPI = parent;
lmsAPI.SetScore(score, 100, 0);
SetStatus("passed");
bump
You might need the code to say: lmsAPI.SetStatus("passed");
This discussion is closed. You can start a new discussion or contact Articulate Support.