Using js to submit a custom score to an LMS

Mar 29, 2019

I've been reading past threads about this and trying all the code permutations I've found. It looks as if it's not possible to send a custom score to an LMS using Storyline 360 - is that correct? I've been trying sending variations of the following to SCORMCloud - in each case I inserted a test score of 90 points into the code. Neither method worked.

Method 1


var lmsAPI = parent;
lmsAPI.SetScore(90, 100, 0);
SCORM_CallLMSSetValue("cmi.core.lesson_status", "complete");

 

I also found that sometimes "parent" can't be found … so I also tried the following code - also it didn't work …

Method 2

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(90,100, 0);
SCORM_CallLMSSetValue("cmi.core.lesson_status", "complete");

If anyone does have a solution, please let me know - I'm creating a quiz with bonus points based on time taken to answer each question, so using Results.ScorePoints is no use as SL won't let me overwrite that variable. Of course if there IS now a way to overwrite Results.ScorePoints I'd be fine with that!

3 Replies
Zsolt Olah

Rob,

Method #2 kind of works for me on ScormCloud with a caveat. If you're using Scorm 1.2 it returns an 405 error because "complete" is not an acceptable value. 

cmi.core.lesson_status (“passed”, “completed”, “failed”, “incomplete”, “browsed”, “not attempted”, RW) Indicates whether the learner has completed and satisfied the requirements for the SCO

Zsolt