Forum Discussion
ChristophSchmol
22 days agoCommunity Member
Checking course completion with the LMS
When a Storyline training starts, can I check with the LMS to see if the quiz has already been passed? We have updated a course and need to check whether the trainees are returning or new users.
ChristophSchmol
16 days agoCommunity Member
Hi Andrew and Phil,
I asked AI how I could implement the LMS query using JavaScript. Attached is the suggested code for SCORM 2004. (The variable named “BB” in line 36, which I use for the true/false query in Storyline, had already been in my project but was unused.)
I tested the script with our training course in Reach 360 and it actually worked. After completing the quiz, "BB" changed from false to true.
What do you think of the code?
(function () {
// --- SCORM 2004 API discovery ---
function getAPI(win) {
var maxTries = 500;
while (win && maxTries--) {
if (win.API_1484_11) {
return win.API_1484_11;
}
win = win.parent;
}
return null;
}
var api = getAPI(window);
if (!api) {
console.log("SCORM 2004 API not found");
return;
}
// --- Read SCORM status ---
var completionStatus = api.GetValue("cmi.completion_status");
var successStatus = api.GetValue("cmi.success_status");
console.log("Completion:", completionStatus);
console.log("Success:", successStatus);
// --- Decision logic ---
if (
completionStatus === "completed" ||
successStatus === "passed"
) {
// Storyline bridge
var player = GetPlayer();
player.SetVar("BB", true);
}
})();
Related Content
- 2 months ago