Get User ID SCORM 2004, CSOD, JS

Oct 25, 2022

Hello everyone,

We are experiencing an issue with accessing the Learner's ID from our customers LMS Cornerstone on demand. With SCORM 1.2 our Javascript was working without any issue. However, when updating to SCORM 2004 3rd Edition, we no longer receive the correct Learner's ID but another number. It is alwas the same number, but it is not the correct one.

Our old JS for SCORM 1.2 looks like this:

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);

var student_id = lmsAPI.GetStudentID();
var p = GetPlayer();
p.SetVar("user_id",student_id);

And this is how we modified it for SCORM 2004:

function findLMSAPI(win) {
if (win.hasOwnProperty("SCORM2004_GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}

var lmsAPI = findLMSAPI(this);

var student_id = lmsAPI.SCORM2004_GetStudentID();
var p = GetPlayer();
p.SetVar("user_id",student_id);

Can anybody help by finding the cause of this issue and a possible solution?

Thanks :)

Be the first to reply